Two ways to get one
Squash a description
Any technique that keeps the structure of a big space in a smaller one can make an embedding. The map so far used principal component analysis (PCA). It takes the nine per-match numbers of every club, z-scores them as in chapter 5, and finds the two directions along which clubs differ most. Two numbers per club keep 79% of the spread in nine.
Learn it inside a model
The other way is an embedding layer: a hidden layer whose size is the number of dimensions, trained with the rest of the model. Switch the board to Learned. Each club now has two learned numbers, attack and defence. The model predicts every match's goals as exp(base + home bonus + attack − the other side's defence), and gradient descent on 111 matches moves each club's two numbers until the predicted goals fit the real ones. That's the classic football goals model, which is a two-dimensional embedding underneath.
Here the dimensions have names because the model was built that way. In a large network they usually don't. The learned model also finds a home advantage: home sides score 1.36 times as many goals, all else equal.
Contextual embeddings
A static embedding gives each item one point, whatever the context. The word "orange" gets the same vector for the fruit, the colour and the Dutch royal house. A contextual embedding changes with the surroundings. Models such as ELMo, BERT and the transformers behind today's language models build each word's vector from the words around it, so "orange juice" and "orange shirt" get different ones. In football terms, a club without its best striker is a different club, and a contextual embedding could know that from the team sheet.