Skip to content
Road to Intelligence

Concept · Chapter 2: The Math Toolkit

Vectors

Must knowKnow well15 minDifficulty

A vector is an ordered list of numbers, and in machine learning it is how every object — a house, a word, an image — becomes something a model can compute with.

The problem

Models can only do arithmetic. A sentence, a photo or a customer is not a number.

The solution

Describe each object by a fixed-length list of numbers, one per feature or learned dimension, and treat that list as a point (or arrow) in space.

The consequence

Once things are points in space, 'similar' can mean 'nearby', and a model can be a function that moves points around.

Intuition

Describe a house to a computer. You might write down its floor area, number of bedrooms and age:

house=[ 120,  3,  15 ]\text{house} = [\,120,\; 3,\; 15\,]

That list is a vector. Its dimension is 3 because it has three entries. The order matters: position 1 always means area, position 2 always means bedrooms.

The same trick works for anything. A grey-scale 28×28 image is a vector of 784 pixel brightnesses. In a language model, each token is a vector of a few thousand numbers — but there, nobody chooses what the dimensions mean. The model learns them.

Two pictures of the same thing

The arrow picture lets us talk about direction (which way it points) and length (how far it goes). These two ideas return everywhere: similarity is about direction, and many training problems are about lengths getting too large or too small.

Where it appears in AI

  • Features in classical ML: each row of your training table is a vector.
  • Embeddings: words, tokens, documents and images become learned vectors, placed so that similar things end up near each other.
  • Weights: a neuron's weights are a vector too, and its job is to measure how much an input points in the same direction — which is the dot product.

What to remember

  • A vector is a list of numbers with a fixed length — its dimension.
  • Geometrically it is an arrow or a point; both pictures are useful.
  • In ML, each dimension is a feature (hand-chosen or learned).

Watch