First, untangle the terms
AI, machine learning, neural networks and deep learning are related. They are not interchangeable. We start by putting them in the right order, then compare the three learning setups people usually mean.
A compact map of the ideas behind artificial intelligence: what sits inside what, how machines learn, and what a neural network is actually doing when it trains.
Before we begin
AI gets vague quickly. I wanted one reference that follows the thread from “what counts as AI?” to the much less mysterious mechanics of how a neural network learns.
AI, machine learning, neural networks and deep learning are related. They are not interchangeable. We start by putting them in the right order, then compare the three learning setups people usually mean.
A model makes a prediction. The loss tells us how wrong it was. Backpropagation works out which parameters pushed the answer in that direction, and the optimiser nudges them.
The controls are part of the explanation. Click through the comparisons, use the arrows to move between ideas, and open the notes when you want the caveats or sources. The calculus can wait until the appendix.
Foundations
Artificial intelligence is a field. The technology inside it keeps changing.
The recurring question is how a machine can do things we associate with intelligence: perceive, plan, decide, communicate, create. Sometimes that means hand-written rules. Sometimes search. Increasingly, it means learning statistical patterns from data. Same umbrella, very different machinery underneath.
Turing asks a practical version of a slippery question: could a machine convince us through conversation?
Turing proposed the “imitation game”: judge the machine by its conversational behaviour, rather than getting stuck arguing about what was happening inside it.
It turned a beautifully vague philosophical question into something people could test, criticise and try to build toward.
The map
Selected / 01
The broad field: machines doing things we associate with intelligence.
Planning · language · robotics
Machine learning
Supervised learning
The model makes a prediction, checks it against the labelled answer, then adjusts its parameters so the average error gets smaller. Real systems often mix more than one of these setups.
Image classification · spam detection · forecasting
Learning with targets
You show the model the question and the answer.
The input is x. The answer we wanted is y. The model produces ŷ, measures how far off it was, then changes its parameters a little. Repeat this across enough examples and useful patterns begin to stick.
Training objectiveL = (1/n) Σi=1n ℓ(yi, ŷi)Minimise average loss across the training set.
The answer is a category: spam / not spam, one diagnosis among several, cat / definitely not cat.
The answer is a number: battery life, blood glucose, tomorrow's demand or the price of an asset.
What counts as wrong
The model cannot optimise “be more correct”. It needs a number.
A loss function turns each mistake into a penalty. The right choice follows the kind of answer we expect and which mistakes should matter most.
01What shape is the answer?A category, a probability or a continuous value?
02Which mistakes cost more?Should one large miss outweigh several small ones?
03How noisy is the data?Should unusual examples dominate the update?
−[y log(ŷ) + (1−y) log(1−ŷ)]Use it when the target is one of two classes and the model outputs a probability. It gives a small penalty to a confident correct answer and a steep penalty to a confident wrong one.
−log p(correct class)Use it when the output is a probability distribution across mutually exclusive classes. Training rewards the model for moving probability mass onto the correct category.
car0.12
bicycle · correct0.72
van0.16
(y − ŷ)²Use it when the answer is a number and larger misses should matter disproportionately. Squaring makes an error of 20 count sixteen times as much as an error of 5.
Target60
−Prediction55
→Squared loss25
Target60
−Prediction40
→Squared loss400
|y − ŷ| · or · smooth then linearUse a more robust loss when a few unusual values should not overwhelm the ordinary examples. MAE grows linearly; Huber behaves like squared error near zero and becomes linear for large misses.
Learning without targets
There are examples, but no answer key.
That does not mean the system just wanders around. It still needs an objective: make the groups tighter, reconstruct the input more accurately, or find a representation that keeps the useful structure and drops some of the noise.
Puts similar things near each other.
Market segments · document groups · image regionsFinds things that tend to show up together.
Basket analysis · listening habits · recommendationsUses fewer dimensions without throwing away the useful part.
Visualisation · preprocessing · compact representationsLearning through action
ObjectiveChoose actions that maximise expected cumulative return.
The feedback comes after an action. Sometimes much later.
The agent learns a policy: a strategy for what to do in a given situation. The awkward bit is that one action changes what happens next. So the useful question is not “Was that move correct?” but “Did this chain of choices lead somewhere better?”
A warehouse robot chooses a route, hits congestion and arrives late. That final delay is feedback about the earlier choices too—not just the last turn.
Across many attempts, actions that tend to produce better long-term outcomes become more likely in similar situations.
Optimisation
The gradient gives us a direction. The learning rate decides how bold to be.
A forward pass produces a prediction and a loss. Backpropagation asks how a tiny change in each parameter would change that loss. Gradient descent then moves the parameters a short distance downhill. Short enough to learn; not so large that we jump straight past the useful bit.
Important caveat: the gradient only knows the local slope. It is not a map to the best possible solution. Step too far and you overshoot; step too carefully and training takes forever.
Layered models
A deep network is a lot of small calculations, connected and repeated.
One neuron combines its inputs, adds a bias and passes the result through an activation. A layer does many of these calculations at once. Stack the layers and each one gets to work with the patterns found by the one before it.
Start with the small calculation. Then zoom out and see how quickly it becomes a system.
View 01 / one artificial neuron
combine the inputsz = Σ wixi + b
produce an activationa = σ(z)
View 02 / a layered network
Inputis whatever we hand the model.
Hidden layersturn earlier patterns into new ones.
Outputis shaped for the answer the task needs.
Expressive power
Without them, depth is mostly an illusion.
A layer that only multiplies and adds is an affine transformation. Stack several of them and the algebra still collapses into one affine transformation. The network may be deeper, but it cannot learn a more complicated kind of boundary.
However many layers we add, the final boundary is still straight.
Each activation adds a bend. Stack enough of them and the model can carve out much richer shapes.
Expressive power
An activation sits between one weighted sum and whatever happens next.
Without a nonlinear activation, stacking layers buys us very little: the whole network still collapses into one linear map. At the final layer, the function also tells us what the output means—a number, a binary probability, or a spread of probabilities across classes.
Click the functions. The shape is the point: it determines what gets through and what gets flattened.
max(0, x)ReLU turns negative inputs into zero and leaves positive ones alone. That one kink is enough to make the network nonlinear, and it is cheap to compute. The trade-off: a unit can go quiet if it gets stuck on the negative side.
(ex − e-x) / (ex + e-x)Tanh squeezes every value into the range −1 to 1, with zero in the middle. Push the input far enough in either direction and the curve goes flat. The gradient gets tiny there, which can make learning painfully slow.
f(x) = xA linear output simply passes the value through. Useful when the answer can be any number—a temperature, a price, a demand forecast. But make every hidden layer linear and the entire network still behaves like one linear transformation.
1 / (1 + e-x)Sigmoid squeezes one score into the range 0 to 1, which is handy when the output is a binary probability. Same catch as tanh: at the extremes the curve flattens and the gradient gets small.
ezᵢ / ΣjezⱼSoftmax looks at the whole set of class scores together. Each answer depends on all the others, and the final values add up to one. Useful when the model must choose between several mutually exclusive classes.
Architecture catalogue
An architecture is a bet about which relationships matter.
Images have neighbourhoods. Sequences have order. Generative models need a way to build rather than only classify. Click a family to see the assumption built into it.
Every unit in one layer can contribute to every unit in the next. It is the plainest version of the layered calculation we have already seen.
A small learned filter moves across the input. The same detector can recognise an edge or texture wherever it appears.
The network carries a hidden state from one step to the next. LSTM gates decide what to write, keep and reveal from that state.
y₅
Attention lets each item build its representation from the other relevant items, instead of passing context along one step at a time.
An encoder squeezes an example into a smaller latent representation; a decoder tries to reconstruct it. A VAE makes that latent space probabilistic.
A generator tries to make convincing examples. A discriminator tries to spot the fakes. Each model makes the other one harder to fool.
Training teaches the model to reverse a gradual noising process. Generation starts from noise and repeatedly turns it into a structured sample.
The model makes a prediction. The loss judges it. Backpropagation works out the gradients. The optimiser changes the parameters. The next three slides say the same thing again, just with the notation left in.
Appendix / derivation I
Before we move backward, keep the useful bits from the journey forward.
The weights and bias combine the previous activations into zℓ. Save it. Later we need to know exactly where each neuron sat on its activation curve.
The activation function turns zℓ into aℓ. At the output layer, aK is the prediction the loss is about to judge.
The loss does not see zK directly. It sees aK, which depends on zK. The chain rule says: follow that path and multiply the sensitivities along it.
That sensitivity is δK. In plain language: if the output layer's weighted input moved a tiny amount, how much would the loss move?
Click the path to connect prose and notation
Once we have this signal, the output-layer parameter gradients fall out directly.
Bias gradient∂L / ∂bK = δK
Weight gradient∂L / ∂WK = δK(aK−1)T
∇aL all loss sensitivities at a · σ′ local activation slope · ⊙ element-wise multiplication
Appendix / derivation II
A hidden layer affects the loss through everything that comes after it.
Assume we already know δℓ+1: how sensitive the loss is to the next layer. Reuse it. Starting again from the loss every time would be wasteful.
The next layer used Wℓ+1 to send activations forward. The transpose sends sensitivity the other way, spreading the next layer's signal back across this one.
The activation may strengthen, weaken or completely block a small change. Multiplying by σ′(zℓ) accounts for what each neuron was doing locally.
The result is δℓ. Then the exact same reasoning repeats for layer ℓ−1, and keeps going until we reach the front.
Click each factor in the backward path
Take the next layer's signal, map it backward through the transposed weights, then apply this layer's local activation slope. That is the recursion.
W sends activations forward. WT sends sensitivity back into the previous layer's shape.
σ′ tells us how strongly this activation responds to a tiny change in z.
The outer product gives one gradient for every weight. The optimiser then takes the step.
Appendix / derivation III
A recurrent network reuses one calculation. To train it, draw every use.
Write the hidden state once for every timestep. The repeated boxes are not separate layers: they are the same calculation reusing the same weights.
Each output may contribute a loss Lt. The training objective combines them across the sequence.
A shared weight affects many timesteps, so its gradient is the sum of the contributions from every place it was used.
Repeated derivatives can shrink or explode. Truncated BPTT stops after a chosen window, trading longer memory for cheaper, steadier training.
One recurrent cell, shown at four timesteps
Recurrent stateht = φ(Wxhxt + Whhht−1 + b)
Sequence lossL = ΣtLt
Shared weight∇WhhL = Σtδtht−1T