Pro
Pro lesson

Words as vectors

Turn words into lists of numbers, and meaning into distance, using real word vectors.

This one’s part of How Models Learn Pro — every lesson, every interactive, and new ones as they land. About 10 minutes.

Already Pro? Sign in and you’ll go straight in.

Inside “Words as vectors”

What you’ll learn

  1. Words into numbers
  2. Similar words point the same way
  3. A map of meaning
  4. Arithmetic with meaning
  5. Real models learn their own features

Key terms

Vector
An ordered list of numbers. It can be pictured as an arrow pointing somewhere in space.
Embedding
The vector a model uses to represent a word (or other item), arranged so that similar things get similar vectors.
GloVe
A widely used set of word vectors from Stanford (2014), learned from how often words appear near each other in billions of words of text.
Dimension
One position in a vector. A GloVe vector has 300 numbers, so it lives in a 300-dimensional space.
Cosine similarity
A score from −1 to 1 that measures the angle between two vectors: 1 means they point the same way.
Nearest neighbours (of a word)
The items whose vectors are most similar to a given item’s vector.
Direction
A line through the space, such as female − male, found by averaging the differences between word pairs. Measuring a vector along it gives a meaningful score.
PCA
Principal component analysis: a standard way to flatten many dimensions into a few by keeping the directions along which the data spreads out most.
Word analogy
Vector arithmetic such as king − man + woman, whose result lands near a related word like queen.

Sources