code: def make_scorer(
      score_func,
      *,
      greater_is_better=True,
      needs_proba=False,
      needs_threshold=False,
      **kwargs,
  ):
      """Make a scorer from a performance metric or loss function.
  
      This factory function wraps scoring functions for use in
      :class:`~sklearn.model_selection.GridSearchCV` and
      :func:`~sklearn.model_selection.cross_val_score`.
      It takes a score function, such as :func:`~sklearn.metrics.accuracy_score`,
      :func:`~sklearn.metrics.mean_squared_error`,
      :func:`~sklearn.metrics.adjusted_rand_score` or
      :func:`~sklearn.metrics.average_precision_score`
      and returns a callable that scores an estimator's output.
      The signature of the call is `(estimator, X, y)` where `estimator`
      is the model to be evaluated, `X` is the data and `y` is the
      ground truth labeling (or `None` in the case of unsupervised models).
  
      Read more in the :ref:`User Guide <scoring>`.
  
      Parameters
      ----------
      score_func : callable
          Score function (or loss function) with signature
          ``score_func(y, y_pred, **kwargs)``.
  
      greater_is_better : bool, 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 : bool, default=False
          Whether `score_func` requires `predict_proba` to get probability
          estimates out of a classifier.
  
          If True, for binary `y_true`, the score function is supposed to accept
          a 1D `y_pred` (i.e., probability of the positive class, shape
          `(n_samples,)`).
  
      needs_threshold : bool, default=False
          Whether `score_func` takes a continuous decision certainty.
          This only works for binary classification using estimators that
          have either a `decision_function` or `predict_proba` method.
  
          If True, for binary `y_true`, the score function is supposed to accept
          a 1D `y_pred` (i.e., probability of the positive class or the decision
          function, shape `(n_samples,)`).
  
          For example `average_precision` or the area under the roc curve
          can not be computed using discrete predictions alone.
  
      **kwargs : additional arguments
          Additional parameters to be passed to `score_func`.
  
      Returns
      -------
      scorer : callable
          Callable object that returns a scalar score; greater is better.
  
      Notes
      -----
      If `needs_proba=False` and `needs_threshold=False`, the score
      function is supposed to accept the output of :term:`predict`. If
      `needs_proba=True`, the score function is supposed to accept the
      output of :term:`predict_proba` (For binary `y_true`, the score function is
      supposed to accept probability of the positive class). If
      `needs_threshold=True`, the score function is supposed to accept the
      output of :term:`decision_function` or :term:`predict_proba` when
      :term:`decision_function` is not present.
  
      Examples
      --------
      >>> from sklearn.metrics import fbeta_score, make_scorer
      >>> ftwo_scorer = make_scorer(fbeta_score, beta=2)
      >>> ftwo_scorer
      make_scorer(fbeta_score, beta=2)
      >>> from sklearn.model_selection import GridSearchCV
      >>> from sklearn.svm import LinearSVC
      >>> grid = GridSearchCV(LinearSVC(), param_grid={'C': [1, 10]},
      ...                     scoring=ftwo_scorer)
      """
      sign = 1 if greater_is_better else -1
      if needs_proba and needs_threshold:
          raise ValueError(
              "Set either needs_proba or needs_threshold to True, but not both."
          )
      if needs_proba:
          cls = _ProbaScorer
      elif needs_threshold:
          cls = _ThresholdScorer
      else:
          cls = _PredictScorer
      return cls(score_func, sign, kwargs)
  
imports: import copy
  import warnings
  from collections import Counter
  from functools import partial
  from inspect import signature
  from traceback import format_exc
  import numpy
  from ..base import is_regressor
  from ..utils import Bunch
  from ..utils._param_validation import HasMethods, StrOptions, validate_params
  from ..utils._response import _get_response_values
  from ..utils.metadata_routing import MetadataRequest, MetadataRouter, _MetadataRequester, _routing_enabled, get_routing_for_object, process_routing
  from ..utils.multiclass import type_of_target
  from .None import accuracy_score, average_precision_score, balanced_accuracy_score, brier_score_loss, class_likelihood_ratios, explained_variance_score, f1_score, jaccard_score, log_loss, matthews_corrcoef, max_error, mean_absolute_error, mean_absolute_percentage_error, mean_gamma_deviance, mean_poisson_deviance, mean_squared_error, mean_squared_log_error, median_absolute_error, precision_score, r2_score, recall_score, roc_auc_score, top_k_accuracy_score
  from .cluster import adjusted_mutual_info_score, adjusted_rand_score, completeness_score, fowlkes_mallows_score, homogeneity_score, mutual_info_score, normalized_mutual_info_score, rand_score, v_measure_score
label_desc: Use image node_id 4 for calling a global function with example usage: make_scorer(score_func) and returns: cls