A one-hot club is 20 numbers with nothing in common. An embedding packs it into a few numbers that put similar clubs side by side.
Estimated time: 5 minutes · page 1 of 5
The trouble with one-hot
Chapter 6 turned each club into a one-hot vector, 20 numbers with a single 1. That works, but it has a cost. Feed it into a layer of 8 neurons and the club alone needs 20 × 8 = 160 weights. With every player in Europe instead of every club, it would be tens of thousands of inputs and millions of weights. More weights need more data, more computing, and more memory, which hurts most on a phone.
There's a deeper problem. One-hot makes every club exactly as different from every other club. Arsenal is as far from Liverpool as from the bottom side, and the model has to learn each one from scratch.
Encoding is the first way you turn data into numbers, one-hot for instance. An embedding is a short, dense vector, a handful of numbers per club, arranged so that similar clubs end up close together. The board already shows one, every club of Premier League as a point in two dimensions. The next pages explain where those positions come from.
Check yourself
What's in this chapter
What an embedding space is and how distance in it means similarity, two ways of getting an embedding, static against contextual embeddings, an exploration of the clubs' map, and both embeddings built from scratch in Python.