code: def test_parallel_custom_metric():
      """Regression test for running parallel training with custom transformer"""
  
      def _custom_metric(y, y_pred, w):
          """Calculate the root mean square error."""
          return np.sqrt(np.average(((y_pred - y) ** 2), weights=w))
  
      custom_metric = make_fitness(
          function=_custom_metric, greater_is_better=True
      )
      est = SymbolicRegressor(
          generations=2, metric=custom_metric, random_state=0, n_jobs=2
      )
      est.fit(diabetes.data, diabetes.target)
      _ = pickle.dumps(est)
  
      # Unwrapped functions should fail
      custom_metric = make_fitness(
          function=_custom_metric, greater_is_better=True, wrap=False
      )
      est = SymbolicRegressor(
          generations=2, metric=custom_metric, random_state=0, n_jobs=2
      )
      est.fit(diabetes.data, diabetes.target)
      assert_raises(AttributeError, pickle.dumps, est)
  
      # Single threaded will also fail in non-interactive sessions
      est = SymbolicRegressor(
          generations=2, metric=custom_metric, random_state=0
      )
      est.fit(diabetes.data, diabetes.target)
      assert_raises(AttributeError, pickle.dumps, est)
  
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 5 for calling a global function with example usage: test_parallel_custom_metric() and returns: np