tabensemb.utils.utils.metric_sklearn#

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

Calculate metrics using sklearn APIs. The format of y_true and y_pred should follow the requirement of metric (See https://scikit-learn.org/stable/modules/model_evaluation.html), so we recommend using auto_metric_sklearn() to automatically deal with different metrics.

Parameters:
y_true

An array of ground truth values.

y_pred

An array of predictions.

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.

Returns:
float

The metric.