class_docstr: Encapsulate scorer function with extra methods.
  
  Scorer functions are functions used to compute various performance metrics, using the model and data as inputs,
  rather than the labels and predictions. Scorers are callables with the signature scorer(model, features, y_true).
  Additional data on scorer functions can be found at https://scikit-learn.org/stable/modules/model_evaluation.html.
  
  Parameters
  ----------
  scorer : t.Union[str, t.Callable]
      sklearn scorer name or callable
  model_classes: t.Optional[t.List]
      possible classes output for model. None for regression tasks.
  name : str, default = None
      scorer name
docstr: Convert labels to 0/1 if model is a binary classifier, and converts to multi-label if multiclass.
docstr_tok: ["Convert","labels","to","0\/1","if","model","is","a","binary","classifier",",","and","converts","to","multi-label","if","multiclass","."]
code: def _wrap_classification_model(self, model, data_):
      """Convert labels to 0/1 if model is a binary classifier, and converts to multi-label if multiclass."""
  
      class MyModelWrapper:
          """Convert labels to 0/1 if model is a binary classifier, and converts to multi-label if multiclass."""
  
          def __init__(self, user_model, model_classes, data):
              self.user_model = user_model
              self.model_classes = model_classes
              self.is_binary = (
                  self.model_classes and len(self.model_classes) == 2
              )
              predictions = self.user_model.predict(data)
              if len(data) > 1:
                  predictions = predictions.squeeze()
              self.predictions = pd.Series(
                  predictions, index=data.index
              )
  
          def predict(self, data: pd.DataFrame) -> np.ndarray:
              """Convert labels to 0/1 if model is a binary classifier."""
              # In case of binary converts into 0 and 1 the labels
              predictions = self.predictions[data.index].to_numpy()
              if self.is_binary:
                  transfer_func = np.vectorize(
                      lambda x: 0 if x == self.model_classes[0] else 1
                  )
                  predictions = transfer_func(predictions)
              # In case of multiclass with single label, convert into multi-label
              elif self.model_classes:
                  # if multilabel convert from numpy array of lists to 2d numpy array
                  if (len(predictions) != 0) and is_sequence_not_str(
                      next(iter(predictions))
                  ):
                      predictions = np.array(
                          [np.array(x) for x in predictions]
                      )
                  predictions = _transform_to_multi_label_format(
                      predictions, self.model_classes
                  )
              return predictions
  
          def predict_proba(self, data: pd.DataFrame) -> np.ndarray:
              """Validate model have predict_proba, and the proba matches the model classes."""
              if not hasattr(self.user_model, "predict_proba"):
                  if isinstance(self.user_model, ClassifierMixin):
                      raise errors.DeepchecksValueError(
                          "Model is a sklearn classification model but lacks the"
                          " predict_proba method. Please train the model with"
                          " probability=True."
                      )
                  raise errors.DeepchecksValueError(
                      f"Scorer requires predicted probabilities, either implement "
                      f"predict_proba functionalities within the model objects or pass "
                      f"pre calculated probabilities. {SUPPORTED_MODELS_DOCLINK}"
                  )
              probabilities_per_class = self.user_model.predict_proba(
                  data
              )
              validate_proba(
                  probabilities_per_class, self.model_classes
              )
              return probabilities_per_class
  
          @property
          def classes_(self):
              return np.asarray(
                  [0, 1]
                  if len(self.model_classes) == 2
                  else self.model_classes
              )
  
      return MyModelWrapper(model, self.model_classes, data_)
  
imports: import logging
  import typing
  import warnings
  from numbers import Number
  from typing import TYPE_CHECKING
  import numpy
  import pandas
  from packaging import version
  from sklearn import __version__
  from sklearn.base import ClassifierMixin
  from sklearn.metrics import get_scorer, log_loss, make_scorer, mean_absolute_error, mean_squared_error
  from sklearn.metrics._scorer import _BaseScorer, _ProbaScorer
  from sklearn.preprocessing import OneHotEncoder
  from deepchecks.core import errors
  from deepchecks.tabular.metric_utils.additional_classification_metrics import false_negative_rate_metric, false_positive_rate_metric, roc_auc_per_class, true_negative_rate_metric
  from deepchecks.tabular.utils.task_type import TaskType
  from deepchecks.utils.docref import doclink
  from deepchecks.utils.logger import get_logger
  from deepchecks.utils.metrics import get_scorer_name
  from deepchecks.utils.simple_models import PerfectModel
  from deepchecks.utils.typing import BasicModel
  from deepchecks.utils.validation import is_sequence_not_str
label_desc: Use image node_id 5 for calling the DeepcheckScorer obj's underlying member method code with example usage: obj._wrap_classification_model(model, data_) and returns: MyModelWrapper, predictions, probabilities_per_class, np