pycaret.clustering.add_metric#
- pycaret.clustering.add_metric(id: str, name: str, score_func: type, target: str = 'pred', greater_is_better: bool = True, multiclass: bool = True, **kwargs) Series[source]#
Adds a custom metric to be used in all functions.
- 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 a score function (default), meaning high is good, or a loss function, meaning low is good. In the latter case, the scorer object will sign-flip the outcome of the score_func.
- multiclass: bool, default = True
Whether the metric supports multiclass problems.
- **kwargs:
Arguments to be passed to score function.
- Returns:
pandas.Series