roc_auc_score#

cuml.metrics.roc_auc_score(y_true, y_score)[source]#

Compute Area Under the Receiver Operating Characteristic Curve (ROC AUC) from prediction scores.

Note

this implementation can only be used with binary classification.

Parameters:
y_truearray-like of shape (n_samples,)

True labels. The binary cases expect labels with shape (n_samples,)

y_scorearray-like of shape (n_samples,)

Target scores. In the binary cases, these can be either probability estimates or non-thresholded decision values (as returned by decision_function on some classifiers). The binary case expects a shape (n_samples,), and the scores must be the scores of the class with the greater label.

Returns:
aucfloat

Examples

>>> import numpy as np
>>> from cuml.metrics import roc_auc_score
>>> y_true = np.array([0, 0, 1, 1])
>>> y_scores = np.array([0.1, 0.4, 0.35, 0.8])
>>> print(roc_auc_score(y_true, y_scores))
0.75