Skip to main content

models.roc()

The ROC curve of a binary model (CAS Monograph 5, section 7.3.1): the

Usage

models.roc(
    y,
    score,
    weights=None,
)

true and false positive rates with each distinct score as threshold (a row is positive when its score is at least the threshold), and the area under the curve, ties counting half.

Parameters

y: list of float

0 or 1.

score: list of float
weights: list of float = None

Returns

dict
thresholds (descending, from inf), false_positive_rate, true_positive_rate and auc.

Examples

>>> from prospicio.models import roc
>>> roc([0.0, 0.0, 1.0, 1.0], [0.1, 0.4, 0.35, 0.8])["auc"]

0.75