Recall at a fixed false positive rate: the fraud metric
An operational reading of the ROC curve: for each false positive budget (0.1%, 0.5%, 1%, 5%), the threshold to apply, the recall obtained and the daily alert volume the team will have to absorb.
Prerequisites
scikit-learn, numpy
Python
import numpy as np
from sklearn.metrics import roc_curve, roc_auc_score
proba = model.predict_proba(X_test)[:, 1]
fpr, tpr, seuils = roc_curve(y_test, proba)
print(f"AUC globale : {roc_auc_score(y_test, proba):.4f}")
print("FPR_cible seuil rappel alertes/jour")
for fpr_cible in [0.001, 0.005, 0.01, 0.05]:
i = np.searchsorted(fpr, fpr_cible, side="right") - 1
volume_jour = int((proba >= seuils[i]).sum() / 30) # test = 30 jours
print(f"{fpr_cible:>8.1%} {seuils[i]:.4f} {tpr[i]:>6.1%}"
f" {volume_jour:>10}")Result
AUC globale : 0.9412
FPR_cible seuil rappel alertes/jour
0.1% 0.9871 31.2% 4
0.5% 0.9407 52.8% 14
1.0% 0.8964 63.4% 26
5.0% 0.6213 88.1% 117
L'équipe fraude absorbe 25 alertes/jour maximum : on opère donc à
FPR 1 % — 63 % des fraudes captées pour 26 alertes/jour.
L'AUC de 0.94 ne disait rien de tout cela : c'est le rappel À
CONTRAINTE DE CHARGE qui pilote la décision opérationnelle.FraudeTPR@FPRCourbe ROCSeuil