code: def test_custom_transformer_metrics():
      """Check whether greater_is_better works for SymbolicTransformer."""
  
      est_gp = SymbolicTransformer(
          generations=2,
          population_size=100,
          hall_of_fame=10,
          n_components=1,
          metric="pearson",
          random_state=415,
      )
      est_gp.fit(diabetes.data, diabetes.target)
      for program in est_gp:
          formula = program.__str__()
      expected_formula = "mul(-0.111, add(add(X9, sub(X2, 0.606)), X3))"
      assert expected_formula == formula
  
      def _neg_weighted_pearson(y, y_pred, w):
          """Calculate the weighted Pearson correlation coefficient."""
          with np.errstate(divide="ignore", invalid="ignore"):
              y_pred_demean = y_pred - np.average(y_pred, weights=w)
              y_demean = y - np.average(y, weights=w)
              corr = (
                  np.sum(w * y_pred_demean * y_demean) / np.sum(w)
              ) / np.sqrt(
                  (
                      np.sum(w * y_pred_demean**2)
                      * np.sum(w * y_demean**2)
                  )
                  / (np.sum(w) ** 2)
              )
          if np.isfinite(corr):
              return -1 * np.abs(corr)
          return 0.0
  
      neg_weighted_pearson = make_fitness(
          function=_neg_weighted_pearson, greater_is_better=False
      )
  
      c_est_gp = SymbolicTransformer(
          generations=2,
          population_size=100,
          hall_of_fame=10,
          n_components=1,
          stopping_criteria=-1,
          metric=neg_weighted_pearson,
          random_state=415,
      )
      c_est_gp.fit(diabetes.data, diabetes.target)
      for program in c_est_gp:
          c_formula = program.__str__()
      assert expected_formula == 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 3 for calling a global function with example usage: test_custom_transformer_metrics() and returns: int, unknown