code: def make_scorer(
      name,
      score_func,
      *,
      optimum=1,
      greater_is_better=True,
      needs_proba=False,
      needs_threshold=False,
      needs_quantile=False,
      metric_kwargs: dict = None,
      **kwargs,
  ) -> Scorer:
      """Make a scorer from a performance metric or loss function.
  
      Factory inspired by scikit-learn which wraps scikit-learn scoring functions
      to be used in auto-sklearn.
  
      Parameters
      ----------
      score_func : callable
          Score function (or loss function) with signature
          ``score_func(y, y_pred, **kwargs)``.
  
      optimum : int or float, default=1
          The best score achievable by the score function, i.e. maximum in case of
          scorer function and minimum in case of loss function.
  
      greater_is_better : boolean, default=True
          Whether score_func is a score function (default), meaning high is good,
          or a loss function, meaning low is good. In the latter case, the
          scorer object will sign-flip the outcome of the score_func.
  
      needs_proba : boolean, default=False
          Whether score_func requires predict_proba to get probability estimates
          out of a classifier.
  
      needs_threshold : boolean, default=False
          Whether score_func takes a continuous decision certainty.
          This only works for binary classification.
  
      needs_quantile : boolean, default=False
          Whether score_func is based on quantile predictions.
          This only works for quantile regression.
  
      metric_kwargs : dict
          Additional parameters to be passed to score_func, merged with kwargs if both are present.
          metric_kwargs keys will override kwargs keys if keys are shared between them.
  
      **kwargs : additional arguments
          Additional parameters to be passed to score_func.
  
      Returns
      -------
      scorer
          Callable object that returns a scalar score; greater is better.
      """
      sign = 1 if greater_is_better else -1
      if needs_proba:
          cls = _ProbaScorer
      elif needs_threshold:
          cls = _ThresholdScorer
      elif needs_quantile:
          cls = _QuantileScorer
      else:
          cls = _PredictScorer
      if metric_kwargs is not None:
          kwargs.update(metric_kwargs)
      return cls(
          name=name,
          score_func=score_func,
          optimum=optimum,
          sign=sign,
          kwargs=kwargs,
      )
  
imports: import json
  from abc import ABCMeta, abstractmethod
  from functools import partial
  import numpy
  import scipy
  import scipy.stats
  import sklearn.metrics
  from ..constants import BINARY, MULTICLASS, QUANTILE, REGRESSION, SOFTCLASS
  from .None import classification_metrics, quantile_metrics
  from .classification_metrics import confusion_matrix
label_desc: Use image node_id 2 for calling a global function with example usage: make_scorer(name, score_func) and returns: cls