class_docstr: Wrapper to encode y_true and y_pred if necessary.
class_docstr_tok: ["Wrapper","to","encode","y_true","and","y_pred","if","necessary","."]
code: def __call__(self, y_true, y_pred, **kwargs):
      try:
          return self.score_func(y_true, y_pred, **kwargs)
      except ValueError as e:
          if self.labels is not None and "is not a valid label" in str(
              e
          ):
              encoder = LabelEncoder()
              encoder.classes_ = self.labels
              return self.score_func(
                  encoder.transform(y_true),
                  encoder.transform(y_pred),
                  **kwargs,
              )
          else:
              raise
  
imports: import traceback
  import warnings
  from typing import Callable
  import numpy
  from sklearn.exceptions import FitFailedWarning
  from sklearn.metrics._scorer import _PredictScorer, _ProbaScorer, _ThresholdScorer
  from sklearn.preprocessing import LabelEncoder
  from sklearn.utils import _safe_indexing
  from pycaret.utils.generic import get_label_encoder
label_desc: Use image node_id 2 for calling the EncodedDecodedLabelsReplaceScoreFunc obj's underlying member method code with example usage: obj.__call__(y_true, y_pred) and returns: self, self