AUC (Area Under ROC Curve)
Core Metrics DS practice problem on Onlearn.
Difficulty: medium.
Topics: Understanding the Area Under the Receiver Operating Characteristic Curve (AUC-ROC), True Positive Rate (TPR), False Positive Rate (FPR), ROC Curve Construction, Trapezoidal Integration, Threshold-invariant Metrics, Model Evaluation, Statistical Learning, Information Theory, Probability Theory, Classification Metrics, Binary Classification, Threshold Selection, Sensitivity and Specificity, Rank-based Statistics, Performance Visualization.
Implement a function 'calculate auc(y true, y scores)' that computes the Area Under the ROC Curve from scratch. Your function should handle binary classification labels (0 and 1) and continuous probability scores. You should sort the scores and calculate the TPR and FPR at every distinct threshold to compute the area.