code: def generic_sklearn_evaluator(
      name_prefix: str, sklearn_metric: Callable[..., float]
  ) -> UncurriedEvalFnType:
      """
      Returns an evaluator build from a metric from sklearn.metrics
  
      Parameters
      ----------
      name_prefix: str
          The default name of the evaluator will be name_prefix + target_column.
  
      sklearn_metric: Callable
          Metric function from sklearn.metrics. It should take as parameters y_true, y_score, kwargs.
  
      Returns
      ----------
      eval_fn: Callable
         An evaluator function that uses the provided metric
      """
  
      def p(
          test_data: pd.DataFrame,
          prediction_column: str = "prediction",
          target_column: str = "target",
          weight_column: str = None,
          eval_name: str = None,
          **kwargs: Any,
      ) -> EvalReturnType:
          try:
              score = sklearn_metric(
                  test_data[target_column],
                  test_data[prediction_column],
                  sample_weight=None
                  if weight_column is None
                  else test_data[weight_column],
                  **kwargs,
              )
          except ValueError:
              # this might happen if there's only one class in the fold
              score = np.nan
  
          if eval_name is None:
              eval_name = name_prefix + target_column
  
          return {eval_name: score}
  
      return p
  
imports: import warnings
  from typing import Any, Callable, Iterable, List
  import numpy
  import pandas
  import toolz
  from pandas.util import hash_pandas_object
  from sklearn.metrics import average_precision_score, brier_score_loss, fbeta_score, log_loss, mean_absolute_error, mean_squared_error, precision_score, r2_score, recall_score, roc_auc_score
  from toolz import curry, last, first
  from scipy import optimize
  from sklearn.linear_model import LogisticRegression
  from fklearn.types import EvalFnType, EvalReturnType, PredictFnType, UncurriedEvalFnType
label_desc: Use image node_id 1 for calling a global function with example usage: generic_sklearn_evaluator(name_prefix, sklearn_metric) and returns: p, dict