Skip to content

Machine Learning Through Football

How models learn from past matches to predict the next one: features and targets, training and testing, and the traps in between.

14 parts Beginner to Advanced

Start at part 1

Foundations

What a model is, how to test one honestly, and how to score a forecast. Parts 1 to 7.

What are we trying to predict? Features and targets

Every machine learning model starts with two decisions, what to predict and what to tell the model. The first is the target, the second the features, and real SPFL results show why the features matter as much as the model.

Beginner Part 1

Brilliant in training, gone on matchday. Overfitting

A model can learn its training matches too well, rules and all, and then fall apart on matches it hasn't seen. Real SPFL seasons show how it happens, how to spot it, and what to do about it.

Beginner Part 3

Too simple or too clever? Underfitting vs overfitting

A model can fail by being too simple to see the patterns or too complicated to ignore the noise. Real SPFL seasons, and the bookmakers, show what each looks like and where the sweet spot sits.

Beginner Part 4

Stubborn or jumpy? Bias and variance

A model can be too rigid to learn, or so sensitive that one result rewrites everything it believes. Those are bias and variance, and twenty-five years of SPFL results show what each costs.

Beginner Part 5

One good season or a good model? Cross-validation

A single test season can flatter a model or bury it. Cross-validation tests it again and again on different slices of the data; for football, that means walking forward through the seasons. 23 SPFL seasons show why it matters.

Beginner Part 6

Is accuracy the right score? Evaluating a model

Accuracy counts how many results a model called right, and hides almost everything else. A confusion matrix shows where the mistakes are, probability scores show how confident it was, and five SPFL seasons show why draws break accuracy.

Beginner Part 7

Models

Four ways to predict a match, each tested on the same five seasons. Parts 8 to 11.

Three questions and a prediction. Decision trees

A decision tree predicts a match the way a pundit reasons, with a string of yes-or-no questions, and it learns which questions to ask from the data. On five SPFL test seasons two questions nearly match logistic regression; twelve fall apart.

Intermediate Part 9

Ask a hundred pundits. Random forests

One decision tree is jumpy, so grow a hundred, each on a slightly different set of matches, and average what they say. On five SPFL test seasons the forest fixes most of a single tree's wild guesses, and still finishes just behind logistic regression.

Intermediate Part 10

Learning from its mistakes. Gradient boosting

Start with a rough guess, look at what it got wrong, and fix a little of it with a small tree. Repeat a few hundred times. On five SPFL test seasons gradient boosting draws level with logistic regression, and shows where three numbers run out.

Intermediate Part 11

Advanced

More maths, for readers who want the full method. Parts 12 to 14.

Every team its own attack and defence. Dixon-Coles from scratch

Four machine learning models stalled at the same score on three numbers per match. Rate every team's attack and defence from the goals they score and let in, refit before every matchday, and a classic football model finally gets past them.

Advanced Part 12

Tuning Elo honestly. Five dials and a moving target

Elo has dials to set, from how far one result moves a rating to how much home advantage is worth. Tuned on held-back seasons it draws level with Dixon-Coles on the test seasons. The dial that mattered most changed between eras, and no honest tuning could have seen it coming.

Advanced Part 13

Sure of itself, or just better informed? Calibration in depth

A forecast can lose by being wrong about its own confidence, or by knowing less. Splitting the Brier score into calibration and resolution shows which. On five SPFL test seasons Elo is as well calibrated as the bookmakers, and loses only because they know more.

Advanced Part 14