Machine learning with football · Chapter 4 · Classification

Thresholds and the confusion matrix

Where you draw the line decides which mistakes the model makes. Four boxes count them.

Estimated time: 10 minutes · page 2 of 7

Four boxes

Every match ends up in one of four boxes, depending on what the classifier said and what really happened. Together they make the confusion matrix on the board.

Home win happenedNo home win
Predicted home winTrue positive (TP), called it rightFalse positive (FP), a false alarm
Predicted no home winFalse negative (FN), missed itTrue negative (TN), rightly left out

The rows add up to what the model predicted, TP + FP home wins and FN + TN others. The columns add up to what really happened. A dataset where one column is far bigger than the other is imbalanced. Home wins are about 40 to 50% of matches, so this one is fairly balanced. Red cards or 0–0 draws would not be.

Now move the threshold. Drag it right and fewer matches count as home wins, so false alarms fall but more real home wins slip through. Drag it left and the opposite happens. Which way you lean depends on what each mistake costs you.

Check yourself

The classifier predicts a home win and the match ends 1–1. What kind of result is that?
You raise the threshold. What happens to true positives and false positives?
And true negatives and false negatives?

Leagues