Machine learning with football · Chapter 8 · Neural networks

Multi-class classification

Home win, draw or away win from one network: separate sigmoids, or a softmax that adds up to 100%.

Estimated time: 10 minutes · page 5 of 7

Three outputs instead of one

A match has three outcomes, so a network for it needs three outputs. There are two ways to set them up.

One-vs-all gives each class its own sigmoid output: home win or not, draw or not, away win or not. Each is an independent yes or no, so nothing forces them to add up to 100%. Chapter 4 built this out of separate models, and one network with three sigmoid outputs does the same job more efficiently.

Softmax scores all three classes, then turns the scores into probabilities that compete for the same 100%:

p(class j) = escore j / (escore 1 + escore 2 + escore 3)

Pick a match on the board to see both side by side. Softmax always adds up to exactly 100%, and one-vs-all usually doesn't. With a million classes, such as every word in a language, computing all of them is slow, so candidate sampling scores the right class against a random sample of wrong ones.

Softmax assumes each example belongs to exactly one class. For tags that can be true together, like "both teams scored" and "over 2.5 goals", use a separate sigmoid for each.

Check yourself

Three one-vs-all outputs say home win 25%, draw 23%, away win 49%. Why do they add up to 97% and not 100%?
A model tags a match with "both teams scored" and "over 2.5 goals", and both can be true. Softmax or several sigmoids?

Leagues