code: def add_metric(
      id: str,
      name: str,
      score_func: type,
      greater_is_better: bool = True,
      **kwargs,
  ) -> pd.Series:
      """
      Adds a custom metric to be used in the experiment.
  
  
      Example
      -------
      >>> from pycaret.datasets import get_data
      >>> boston = get_data('boston')
      >>> from pycaret.regression import *
      >>> exp_name = setup(data = boston,  target = 'medv')
      >>> from sklearn.metrics import explained_variance_score
      >>> add_metric('evs', 'EVS', explained_variance_score)
  
  
      id: str
          Unique id for the metric.
  
  
      name: str
          Display name of the metric.
  
  
      score_func: type
          Score function (or loss function) with signature ``score_func(y, y_pred, **kwargs)``.
  
  
      greater_is_better: bool, default = True
          Whether ``score_func`` is higher the better or not.
  
  
      **kwargs:
          Arguments to be passed to score function.
  
  
      Returns:
          pandas.Series
  
      """
  
      return _CURRENT_EXPERIMENT.add_metric(
          id=id,
          name=name,
          score_func=score_func,
          greater_is_better=greater_is_better,
          **kwargs,
      )
  
imports: import logging
  import os
  from typing import Any, BinaryIO, Callable, Dict, List, Optional, Union
  import pandas
  from joblib.memory import Memory
  from pycaret.internal.parallel.parallel_backend import ParallelBackend
  from pycaret.loggers.base_logger import BaseLogger
  from pycaret.regression.oop import RegressionExperiment
  from pycaret.utils.constants import DATAFRAME_LIKE, SEQUENCE_LIKE, TARGET_LIKE
  from pycaret.utils.generic import check_if_global_is_not_none
label_desc: Use image node_id 22 for calling a global function with example usage: add_metric(id, name, score_func, greater_is_better) and returns: _CURRENT_EXPERIMENT