Data and Generalization
This chapter is the heart of CO-1 and CO-2. If you understand it deeply, every model you meet later will make sense, from a decision tree to a billion-parameter network. The question is simple to ask and surprisingly subtle to answer: how can a model that has only seen the past be trusted about the future?
The plan:
- §2.1 Data, models and loss: the three ingredients of supervised learning, and least squares from first principles.
- §2.2 Overfitting and underfitting: what goes wrong when a model is too simple or too flexible, with a slider you can play with.
- §2.3 The bias–variance tradeoff: the mathematical reason why it goes wrong, derived step by step and measured in simulation. This is the classic MDL assignment.
- §2.4 Validation and regularization: the practical cures. Train/validation/test splits, cross-validation and penalizing complexity.
Bolt's problem
Bolt has a log of past deliveries: distance (km) and minutes taken. We want a function that predicts minutes from distance for future orders. The data is noisy: the same 2 km trip took 11 minutes once (empty paths) and 16 minutes another time (the lift was broken). Our model must capture the pattern and ignore the noise. Distinguishing the two is the whole game.