# ROC & Precision–Recall Explorer
# Core implementation example — ackleywill.com

import numpy as np
from sklearn.metrics import (
    roc_curve, precision_recall_curve,
    roc_auc_score, average_precision_score
)

y = np.array([1, 0, 1, 0, 1, 0])
scores = np.array([0.90, 0.80, 0.65, 0.45, 0.30, 0.10])
fpr, tpr, roc_thresholds = roc_curve(y, scores)
precision, recall, pr_thresholds = precision_recall_curve(y, scores)

print("ROC AUC:", roc_auc_score(y, scores))
# Average precision is not trapezoidal PR area.
print("Average precision:", average_precision_score(y, scores))
# PR has one more point than its thresholds array.
