Machine learning with football · Chapter 4

Classification

Chapter 3 gave every match a chance of a home win. Classification turns that chance into an answer, home win or not.

Estimated time: 5 minutes · page 1 of 7

From a chance to an answer

The logistic regression model from chapter 3 gives every match a probability, say 64% for a home win. Often you need a plain answer instead. A tipster has to back the home side or not, and an app has to show a tick or nothing. Turning a probability into one of a few classes is classification. With two classes, home win or not, it is binary classification.

The step is simple. Pick a classification threshold. A match whose chance is above it is predicted a home win, the positive class. Everything at or below it goes to the negative class, no home win. On the board every finished match of Premier League sits at the chance the model gives it. Real home wins are on the upper line, draws and away wins on the lower one, and the line is the threshold.

Move it and watch the dots. Navy ones are classified correctly, orange ones are wrong. 50% sounds like the natural place for it, but it often isn't, and the next pages show why.

Check yourself

The model gives a match a 64% chance of a home win. The threshold is 50%. What does the classifier say?
Two matches score 0.91 and 0.55. At a threshold of 0.8, which are predicted home wins?

What changes from chapter 3

The model is the same, with the same w and b, trained the same way. Classification only adds the last step, so it can't fix a weak model. A badly placed threshold can still waste a good one, though. The rest of this chapter is about choosing it and measuring the result: the confusion matrix, accuracy, precision and recall, ROC and AUC, a quick bias check, and finally three classes instead of two.

Terms on this page: Class, Classification threshold, Positive class

Leagues