roc_auc_score
¶
roc_auc_score(labels: ArrayLike, scores: ArrayLike) -> float
Area under the ROC curve of binary labels ranked by scores.
Computed with the Mann-Whitney U statistic, tied scores getting their
average rank, which gives the same value as scikit-learn's
roc_auc_score.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
labels
|
ArrayLike
|
Binary ground truth ( |
required |
scores
|
ArrayLike
|
Scores of the samples (higher means more likely positive),
shape |
required |
Returns:
| Type | Description |
|---|---|
float
|
The AUC, between 0 and 1. |
Example:
from mlx_graphs.metrics import roc_auc_score
roc_auc_score(mx.array([1, 0, 1, 0]), mx.array([0.9, 0.1, 0.4, 0.5]))
>>> 0.75
Source code in mlx_graphs/metrics/functional.py
from mlx_graphs.metrics import roc_auc_score · mlx_graphs/metrics/functional.py