Derivatives and optimisation
Be able to interpret the derivative as a slope, differentiate simple functions (polynomials), find a minimum by setting the derivative to zero, and understand the chain rule as "slope times slope".
Practise in Mattegrafen ↗ · Matematik 3cPractise in Mattegrafen ↗ · Deriveringsregler — potens, exponentialIntuition
The derivative f'(x) is the slope of the curve at the point x. A positive derivative: the curve goes up. Negative: down. Zero: flat — a peak, a valley or a plateau.
If you are standing on a curve in fog and want to get down into the valley: feel the slope under your feet and walk in the direction that goes down. The derivative is that feeling. The whole of machine learning is built on walking down an error curve that way.
Formal
The rules you need:
- (xⁿ)' = n·xⁿ⁻¹, constants disappear, sums are differentiated term by term
- (c·f)' = c·f'
- The chain rule: if y = f(g(x)) then y' = f'(g(x)) · g'(x) — "outer slope times inner slope"
The minimum of f(x) = x² − 6x + 10: f'(x) = 2x − 6 = 0 ⇒ x = 3, f(3) = 1.
The chain rule on (3x + 1)²: the outer is u², the inner is 3x + 1. The derivative: 2(3x + 1) · 3 = 6(3x + 1).
The chain rule is all of backpropagation: a network is a long chain of functions, and the slope for a weight far back is the product of all the slopes along the way.
Mastery means
- Differentiates a polynomial and solves f'(x) = 0
- Applies the chain rule to a composite function
Prerequisites
Sign in to do the exercises and build your mastery up.
Sources
Leads to
Part of the goals (31)
- The mathematics behind the models
- Statistics for experiments
- Classical ML for real
- Language models in practice
- Train an agent with reward
- Training neural networks for real
- Frontier Lab — an independent research project
- AI safety in practice
- Fine-tune and run your own models
- Multimodal systems
- Build a RAG pipeline with traceable sources
- Generative models in depth
- Build a voice interface
- Responsible AI in practice
- Fine-tune a model with LoRA
- Train your first neural network
- Deep reinforcement learning
- Build an NLP system end to end
- Evals in practice
- AI in production
- Build an agent you can trust
- Run models more cheaply: quantisation
- Build a memory system for an agent
- Build an AI service that survives production
- An AI service in operation
- Understand how generative AI works
- Build a transformer from scratch
- Image classification with convolutional networks
- Reproduce a paper
- Interpreting a language model
- AI, ethics and society