code: def score(f: Callable) -> Callable:
      """Patch decorator for sklearn's _score function.
  
      Monkey patch for sklearn.model_selection._validation._score
      function to score pipelines that drop samples during transforming.
  
      """
  
      def wrapper(*args, **kwargs):
          args = list(args)  # Convert to list for item assignment
          if len(args[0]) > 1:  # Has transformers
              args[1], y_transformed = args[0]._memory_full_transform(
                  args[0], args[1], args[2], with_final=False
              )
              args[2] = args[2][args[2].index.isin(y_transformed.index)]
  
          with pipeline_predict_inverse_only():
              return f(args[0], *tuple(args[1:]), **kwargs)
  
      return wrapper
  
file_path: pycaret/pycaret/internal/patches/sklearn.py
imports: from typing import Any, Callable
  from unittest.mock import patch
  import numpy
  from sklearn.model_selection._validation import _fit_and_score, _score
  from sklearn.utils import check_random_state
  from pycaret.internal.pipeline import pipeline_predict_inverse_only
label_desc: Use image node_id 4 for calling a global function with example usage: score(f) and returns: wrapper, f