docstr: Adds a custom metric to be used in the experiment.
  
  
  Example
  -------
  >>> from pycaret.datasets import get_data
  >>> juice = get_data('juice')
  >>> from pycaret.classification import *
  >>> exp_name = setup(data = juice,  target = 'Purchase')
  >>> from sklearn.metrics import log_loss
  >>> add_metric('logloss', 'Log Loss', log_loss, greater_is_better = False)
  
  
  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)``.
  
  
  target: str, default = 'pred'
      The target of the score function.
  
      - 'pred' for the prediction table
      - 'pred_proba' for pred_proba
      - 'threshold' for decision_function or predict_proba
  
  
  greater_is_better: bool, default = True
      Whether ``score_func`` is higher the better or not.
  
  
  multiclass: bool, default = True
      Whether the metric supports multiclass target.
  
  
  **kwargs:
      Arguments to be passed to score function.
  
  
  Returns:
      pandas.Series
docstr_tok: ["Adds","a","custom","metric","to","be","used","in","the","experiment",".","Example","--","--","--","-",">",">",">","from","pycaret.datasets","import","get_data",">",">",">","juice","=","get_data","(","'juice","'",")",">",">",">","from","pycaret.classification","import","*",">",">",">","exp_name","=","setup","(","data","=","juice",",","target","=","'Purchase","'",")",">",">",">","from","sklearn.metrics","import","log_loss",">",">",">","add_metric","(","'logloss","'",",","'Log","Loss","'",",","log_loss",",","greater_is_better","=","False",")","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",")","``",".","target",":","str",",","default","=","'pred'","The","target","of","the","score","function",".","-","'pred","'","for","the","prediction","table","-","'pred_proba","'","for","pred_proba","-","'threshold","'","for","decision_function","or","predict_proba","greater_is_better",":","bool",",","default","=","True","Whether","``","score_func","``","is","higher","the","better","or","not",".","multiclass",":","bool",",","default","=","True","Whether","the","metric","supports","multiclass","target",".","*","*","kwargs",":","Arguments","to","be","passed","to","score","function",".","Returns",":","pandas.Series"]
code: def add_metric(
      self,
      id: str,
      name: str,
      score_func: type,
      target: str = "pred",
      greater_is_better: bool = True,
      multiclass: bool = True,
      **kwargs,
  ) -> pd.Series:
      """
      Adds a custom metric to be used in the experiment.
  
  
      Example
      -------
      >>> from pycaret.datasets import get_data
      >>> juice = get_data('juice')
      >>> from pycaret.classification import *
      >>> exp_name = setup(data = juice,  target = 'Purchase')
      >>> from sklearn.metrics import log_loss
      >>> add_metric('logloss', 'Log Loss', log_loss, greater_is_better = False)
  
  
      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)``.
  
  
      target: str, default = 'pred'
          The target of the score function.
  
          - 'pred' for the prediction table
          - 'pred_proba' for pred_proba
          - 'threshold' for decision_function or predict_proba
  
  
      greater_is_better: bool, default = True
          Whether ``score_func`` is higher the better or not.
  
  
      multiclass: bool, default = True
          Whether the metric supports multiclass target.
  
  
      **kwargs:
          Arguments to be passed to score function.
  
  
      Returns:
          pandas.Series
  
      """
  
      return super().add_metric(
          id=id,
          name=name,
          score_func=score_func,
          target=target,
          greater_is_better=greater_is_better,
          multiclass=multiclass,
          **kwargs,
      )
  
imports: import datetime
  import gc
  import logging
  import re
  import time
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  from unittest.mock import patch
  import numpy
  import pandas
  import plotly.express
  import sklearn
  from joblib.memory import Memory
  from scipy.optimize import shgo
  from pycaret.containers.metrics.classification import get_all_metric_containers
  from pycaret.containers.models.classification import ALL_ALLOWED_ENGINES, get_all_model_containers, get_container_default_engines
  from pycaret.internal.display import CommonDisplay
  from pycaret.internal.logging import get_logger
  from pycaret.internal.meta_estimators import CustomProbabilityThresholdClassifier, get_estimator_from_meta_estimator
  from pycaret.internal.parallel.parallel_backend import ParallelBackend
  from pycaret.internal.pipeline import Pipeline
  from pycaret.internal.preprocess.preprocessor import Preprocessor
  from pycaret.internal.pycaret_experiment.non_ts_supervised_experiment import _NonTSSupervisedExperiment
  from pycaret.internal.validation import is_sklearn_cv_generator
  from pycaret.loggers.base_logger import BaseLogger
  from pycaret.utils.constants import DATAFRAME_LIKE, SEQUENCE_LIKE, TARGET_LIKE
  from pycaret.utils.generic import MLUsecase, get_classification_task, get_label_encoder, highlight_setup
label_desc: Use image node_id 26 for calling the ClassificationExperiment obj's underlying member method code with example usage: obj.add_metric(id, name, score_func, target, greater_is_better, multiclass) and returns: super