
ROC Curve
Plot true positive rate against false positive rate across all decision thresholds with AUC annotation for model and diagnostic test evaluation.
Sample code / prompt
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
def generate_roc(auc_target, n_points=100):
fpr = np.sort(np.concatenate([[0], np.random.beta(1, auc_target * 5, n_points - 2), [1]]))
tpr = np.sort(np.concatenate([[0], np.random.beta(auc_target * 5, 1, n_points - 2), [1]]))
return fpr, tpr
fig, ax = plt.subplots(figsize=(10, 10))


