Methodology

Backtesting: Avoiding Overfitting

How to test a football model on past seasons without fooling yourself: walk-forward validation, data leakage and multiple testing.

Machine Picks Editorial · · 3 min read

Model analysis roadmap

A backtest runs a model on past matches as if it had been used at the time. Done well, it is the best evidence a model can offer before going live. Done badly, it produces beautiful numbers that collapse the moment real matches begin. The difference almost always comes down to one thing: whether the model was ever allowed to see information it would not have had.

Overfitting in one sentence

A model overfits when it learns the noise in its training data rather than the signal, so it looks excellent on the past and disappoints on the future. Football is especially prone to it: each team plays few matches a season, and results contain a lot of randomness.

Walk-forward validation

The safest structure for testing a football model is walk-forward (also called rolling-origin) validation:

  1. Train on seasons 1 to 5; predict season 6.
  2. Train on seasons 1 to 6; predict season 7.
  3. Continue, always predicting matches after the training data ends.
Round Training data Test data
1 2015-16 to 2019-20 2020-21
2 2015-16 to 2020-21 2021-22
3 2015-16 to 2021-22 2022-23

Random train-test splits, common in other fields, are dangerous here: they let the model learn from matches played after the ones it is predicting.

Data leakage

Leakage is any information in the inputs that would not have been available before kick-off. Common examples:

Worked example: Invented case. A model uses each team's league position as a feature. If the position is taken from the final table rather than the table on the day of the match, the backtest "knows" which teams will finish top. Its accuracy will look impressive and will not survive contact with a live season.

Multiple testing

Every time you try a new feature or setting and keep the version that scores best, you spend some of the test data's credibility. Try enough variations and one will look good by chance.

Key point: Keep a final test period untouched until the very end. Make all design decisions on earlier seasons, then run the final period once. If you have to go back and change things, that period is no longer a clean test.

Our checklist before trusting a backtest

Watch out: Backtested betting profits are the least reliable evidence of all: they combine model error, odds you may not have been able to get and the noise of betting returns. A model should be judged by the quality of its probabilities first.

After the backtest

Live forecasts are the real test. Publishing forecasts before matches and scoring them afterwards, including the bad weeks, is what turns a backtest's promise into evidence. How we do that is described in How to Track Every Prediction.

Reserve a final untouched period

Write down the training window, tuning decisions and final evaluation dates before running comparisons. Once a result influences a parameter choice, that period is no longer a clean final test. Keep unsuccessful experiments in the log so the selected model is not presented without its search history.

18+ only. Model probabilities are estimates, not advice. See our Responsible Gambling page.