Evaluating ML/DL Models
Related: 2. Supervised Learning | 6. Loss Functions and Backpropagation | 11. Handling Class Imbalance | 4. Deep Learning and FCNs | Artificial Intelligence
Model Validation Strategies
Goal: avoid overfitting and find the best hyperparameter combination.
Holdout
Split data into three sets:
| Set | Purpose | Typical Split |
|---|---|---|
| Training | Learn model parameters | 60% |
| Validation | Tune hyperparameters, detect overfitting | 20% |
| Test | Final evaluation on unseen data | 20% |
K-Fold Cross-Validation
- Split dataset into subsets (folds)
- For each fold: train on folds, validate on the remaining fold
- Average results across all runs
Overfitting vs Underfitting
| Underfitting | Good Fit | Overfitting | |
|---|---|---|---|
| Training error | High | Low | Very low |
| Validation error | High | Low | High |
| Model complexity | Too simple | Just right | Too complex |
Solutions to overfitting:
- Early stopping — stop training when validation loss starts increasing
- Regularisation (L2): adds penalty to loss
- Dropout
- More training data
Hyperparameter Optimisation
| Method | Description | Pros | Cons |
|---|---|---|---|
| Grid Search | Exhaustive search over all combinations | Systematic, thorough | Expensive for large spaces |
| Random Search | Random sampling from distributions | More efficient in high dimensions | No guarantee of finding best |
Classification Metrics
Confusion Matrix:
| Predicted Positive | Predicted Negative | |
|---|---|---|
| Actual Positive | True Positive (TP) | False Negative (FN) |
| Actual Negative | False Positive (FP) | True Negative (TN) |
Key metrics:
Why accuracy alone is not enough: In imbalanced datasets (see 11. Handling Class Imbalance), a model that always predicts the majority class achieves high accuracy but is useless. Use precision, recall, and F1-score instead.
AUC-ROC: Area Under the Receiver Operating Characteristic Curve — measures the model’s ability to distinguish between classes across all thresholds.