A trained model is useful only if it performs well on data it has not seen. 2.1. Regression Metrics and 2.2. Classification Metrics show how to score a model, which depends on whether it predicts a number or a class. 2.3. Generalization shows on which data to score it, so that the score reflects performance in deployment.
Prerequisites
- 1. Learning Paradigms, for the supervised setting that the metrics assume.
- 1.2.1 Maximum Likelihood Estimation, for the likelihood view of squared error and log loss.
- 2.2c.3 Gaussian Distribution and 2.2b.3 Bernoulli Distribution, the noise models behind that view.
- 3.1. Linear Regression, the model used in most regression examples.
Contents
- 2.1. Regression Metrics: compares the metrics for numeric predictions and gives a default choice.
- 2.1.1. Mean Squared Error: MSE and RMSE, the conditional mean as minimizer, the Gaussian likelihood view, sensitivity to outliers.
- 2.1.2. Mean Absolute Error: the median as minimizer, the Laplace likelihood view, robustness to outliers.
- 2.1.3. Huber Loss: quadratic for small residuals and linear for large ones, the threshold , smooth L1.
- 2.1.4. R-Squared: the fraction of variance explained, adjusted , negative on test data.
- 2.2. Classification Metrics: compares the metrics for classifiers and gives a default choice.
- 2.2.1. Confusion Matrix: accuracy, precision, recall, specificity, F1, and macro and micro averaging.
- 2.2.2. ROC Curve: the threshold sweep, AUC as a ranking probability, and the pneumonia example.
- 2.2.3. Precision-Recall Curve: average precision, the prevalence baseline, and rare positives.
- 2.2.4. Log Loss: cross-entropy, calibration, proper scoring rules and the Brier score.
- 2.3. Generalization: empirical and population risk, overfitting, the training, validation and test roles, and data leakage.
- 2.3.1. Bias-Variance Decomposition: test error as noise plus squared bias plus variance, the tradeoff curve, double descent.
- 2.3.2. Cross-Validation: -fold, leave-one-out, stratified and nested variants, and splits for dependent data.
Recommended Path
Read 2.3. Generalization first, since every metric means little unless it is computed on held-out data. Then read 2.1.1. Mean Squared Error and 2.2.1. Confusion Matrix, the most common starting points for each task. Finish with 2.3.1. Bias-Variance Decomposition and 2.3.2. Cross-Validation.