No history yet

Model Selection Dynamics

The Generalisation Puzzle

The ultimate goal of a predictive model isn't to perfectly memorise the data it was trained on. Its real test is performance on new, unseen data. This ability to perform accurately on data it has never encountered before is called generalisation. A model that generalises well has learned the true underlying patterns in the data, not just its quirks and noise.

Every model's performance is limited by error. While we can't eliminate error completely, understanding its sources is the key to building robust models. The total error of any model can be broken down into three fundamental components.

Deconstructing Error

When a model makes a prediction, the error in that prediction comes from three distinct sources: bias, variance, and irreducible error. Think of them as the three legs of a stool that supports a model's performance. If one is out of proportion, the whole thing becomes unstable.

E[(yf^(x))2]=(Bias[f^(x)])2+Var[f^(x)]+σ2E[(y - \hat{f}(x))^2] = (Bias[\hat{f}(x)])^2 + Var[\hat{f}(x)] + \sigma^2

Bias is the error introduced by approximating a real-world problem, which may be very complex, with a much simpler model. It's a measure of how far off the model's average prediction is from the correct value we are trying to predict. A model with high bias pays little attention to the training data and oversimplifies, leading to high error on both training and test sets. This is known as .

Variance, on the other hand, is the model's sensitivity to small fluctuations in the training data. A model with high variance pays too much attention to the training data, capturing not only the underlying patterns but also the noise. This model performs well on the training data but poorly on new, unseen data. This is called .

Lesson image

The final component, irreducible error, is the noise that is inherent in the problem itself. It's the variability that comes from unmeasured variables or natural randomness. No matter how good our model is, we can never get rid of this error.

The Trade-Off

This brings us to a central challenge in machine learning: the bias-variance trade-off. It's the tension between the errors introduced by bias and variance.

  • Simple models (like linear regression) tend to have high bias and low variance. Their rigid structure prevents them from fitting the training data too closely, but it also means they might miss complex relationships.

  • Complex models (like high-degree or deep neural networks) tend to have low bias and high variance. Their flexibility allows them to fit the training data very well, but they are so flexible that they can end up modelling the noise. This makes them less reliable on new data.

The goal is to find the sweet spot in the middle. We need a model that is complex enough to capture the underlying patterns in the data, but not so complex that it starts memorising the noise. This is the essence of model selection.

The sweet spot for any model is the level of complexity at which the increase in bias is equivalent to the reduction in variance.

Reading the Signs

How do we know if our model is suffering from high bias or high variance? We can use diagnostic tools like learning curves. A learning curve plots the model's performance on the training set and the validation set as a function of the training set size.

By analysing these curves, we can diagnose the problem:

  • High Bias (Underfitting): Both training and validation errors are high and have converged. The model performs poorly, and adding more data won't help because the model isn't complex enough to learn from it.

  • High Variance (Overfitting): There is a large gap between the low training error and the high validation error. The model has memorised the training data but fails to generalise. The validation error is much higher than the training error, but it may decrease as more data is added.

Understanding where your model's error comes from is the first step toward improving it. Managing the bias-variance trade-off is not about eliminating one or the other, but about finding the right balance that minimises the total error for your specific problem.

Quiz Questions 1/6

In the context of predictive models, what is 'generalisation'?

Quiz Questions 2/6

A machine learning model performs poorly on both the training data and the test data. Which of the following is the most likely cause?