code: def test_custom_regressor_metrics():
      """Check whether greater_is_better works for SymbolicRegressor."""
  
      x_data = check_random_state(0).uniform(-1, 1, 100).reshape(50, 2)
      y_true = x_data[:, 0] ** 2 + x_data[:, 1] ** 2
  
      est_gp = SymbolicRegressor(
          metric="mean absolute error",
          stopping_criteria=0.000001,
          random_state=415,
          parsimony_coefficient=0.001,
          init_method="full",
          init_depth=(2, 4),
      )
      est_gp.fit(x_data, y_true)
      formula = est_gp.__str__()
      assert "add(mul(X0, X0), mul(X1, X1))" == formula
  
      def neg_mean_absolute_error(y, y_pred, sample_weight):
          return -1 * mean_absolute_error(
              y, y_pred, sample_weight=sample_weight
          )
  
      customized_fitness = make_fitness(
          function=neg_mean_absolute_error, greater_is_better=True
      )
  
      c_est_gp = SymbolicRegressor(
          metric=customized_fitness,
          stopping_criteria=-0.000001,
          random_state=415,
          parsimony_coefficient=0.001,
          verbose=0,
          init_method="full",
          init_depth=(2, 4),
      )
      c_est_gp.fit(x_data, y_true)
      c_formula = c_est_gp.__str__()
      assert "add(mul(X0, X0), mul(X1, X1))" == c_formula
  
file_path: gplearn/gplearn/tests/test_fitness.py
imports: import pickle
  import numpy
  from sklearn.datasets import load_diabetes, load_breast_cancer
  from sklearn.metrics import mean_absolute_error
  from sklearn.utils._testing import assert_raises
  from sklearn.utils.validation import check_random_state
  from gplearn.genetic import SymbolicRegressor, SymbolicClassifier
  from gplearn.genetic import SymbolicTransformer
  from gplearn.fitness import make_fitness, _mean_square_error
label_desc: Use image node_id 2 for calling a global function with example usage: test_custom_regressor_metrics() and returns: unknown