code: def local_accuracy(X, y, model_generator, method_name):
      
  
      def score_map(true, pred):
          """ Converts local accuracy from % of standard deviation to numerical scores for coloring.
          """
  
          v = min(1.0, np.std(pred - true) / (np.std(true) + 1e-8))
          if v < 1e-6:
              return 1.0
          elif v < 0.01:
              return 0.9
          elif v < 0.05:
              return 0.75
          elif v < 0.1:
              return 0.6
          elif v < 0.2:
              return 0.4
          elif v < 0.3:
              return 0.3
          elif v < 0.5:
              return 0.2
          elif v < 0.7:
              return 0.1
          else:
              return 0.0
      def score_function(X_train, X_test, y_train, y_test, attr_function, trained_model, random_state):
          return measures.local_accuracy(
              X_train, y_train, X_test, y_test, attr_function(X_test),
              model_generator, score_map, trained_model
          )
      return None, __score_method(X, y, None, model_generator, score_function, method_name)
docs: Local Accuracy
      transform = "identity"
      sort_order = 2