tabensemb.utils.utils.auto_metric_sklearn#

tabensemb.utils.utils.auto_metric_sklearn(y_true: ndarray, y_pred: ndarray, metric: str, task: str) float[source]#

Calculate metrics using sklearn APIs. It automatically deals with different requirements of input shapes for different metrics.

Parameters:
y_true

An array of ground truth values. For classification, it should be the class of each sample. It can be 1d or 2d (the second dimension is 1) for classification tasks.

y_pred

An array of predictions. For classification, it should be the probabilities of classes. It can be 1d or 2d (the second dimension is 1) for binary classification tasks.

metric

Use tabensemb.utils.utils.REGRESSION_METRICS, tabensemb.utils.utils.BINARY_METRICS, and tabensemb.utils.utils.MULTICLASS_METRICS to check all available metrics for regression, binary, and multiclass tasks respectively.

task

“regression”, “multiclass”, or “binary”.

Returns:
float

The metric.