pycaret.regression.add_metric#
- pycaret.regression.add_metric(id: str, name: str, score_func: type, greater_is_better: bool = True, **kwargs) Series[source]#
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_funcis higher the better or not.- **kwargs:
Arguments to be passed to score function.
- Returns:
pandas.Series