Vectors
Be able to add vectors, multiply by a scalar, calculate the dot product and the length, and explain why the dot product measures "how alike" two vectors are.
Practise in Mattegrafen ↗ · Matematik 1cIntuition
A vector is a list of numbers: (3, 4). Draw it as an arrow from the origin. Two numbers give an arrow in the plane, three in space, 768 in… well, a space we cannot draw but can calculate in.
Almost everything in AI is vectors: an image is a long vector of pixel values, a word becomes a vector of hundreds of numbers, a neuron's input is a vector.
Formal
For u = (u₁, u₂, …) and v = (v₁, v₂, …):
- Addition: u + v = (u₁+v₁, u₂+v₂, …)
- Scalar times vector: 2u = (2u₁, 2u₂, …)
- Dot product: u · v = u₁v₁ + u₂v₂ + …
- Length (norm): ‖u‖ = √(u₁² + u₂² + …)
- Cosine similarity: cos θ = (u · v) / (‖u‖ ‖v‖)
The dot product is large when the arrows point the same way, zero when they are perpendicular, negative when they point in opposite directions. That is why it is used to measure similarity: two words with similar meanings have vectors that point in similar directions. (3, 4) · (4, 3) = 24; ‖(3, 4)‖ = 5.
Mastery means
- Calculates the dot product and the norm by hand
- Interprets the cosine similarity between two vectors
Prerequisites
Sign in to do the exercises and build your mastery up.
Sources
Leads to
Part of the goals (35)
- The developer's toolbox
- The mathematics behind the models
- Classical machine learning in practice
- Understand how generative AI works
- Training neural networks for real
- Image classification with convolutional networks
- Frontier Lab — an independent research project
- AI safety in practice
- Classical ML for real
- Multimodal systems
- Run models more cheaply: quantisation
- Systems knowledge for AI engineers
- Seeing and hearing with AI
- Data: collect, clean, document
- Deep reinforcement learning
- Build a transformer from scratch
- Interpreting a language model
- Build a RAG pipeline with traceable sources
- Generative models in depth
- Build a voice interface
- Fine-tune and run your own models
- Fine-tune a model with LoRA
- Language models in practice
- Train your first neural network
- Build a memory system for an agent
- AI in production
- Build an AI service that survives production
- Responsible AI in practice
- Reproduce a paper
- Evals in practice
- Build an agent you can trust
- An AI service in operation
- Statistics for experiments
- Build an NLP system end to end
- AI, ethics and society