VisualAI
Chapter 2 · How Machines Learn

The Neuron

The building block of every neural network is shockingly simple: multiply, add, decide.

8 minLesson 4 of 23

“Neural network” sounds like brain surgery. The building block is so simple you could do it on paper: multiply a few numbers, add them up, and make one yes-or-no decision.

A single neuron takes some input numbers and gives each one a weight — a measure of how much that input matters. It multiplies each input by its weight, adds the results together, adds one more number called the bias, and passes the total through a final step that squashes it into a decision. Below, each dot has two inputs — its position x₁ and x₂ — and the neuron sorts the plane into two coloured regions.

Neuron Playground

Turn the three knobs

Dashed line = the neuron's decision boundary · arrow = the weight direction · drag the ring to test a point

Weight w₁1.20
Weight w₂0.80
Bias b0.00

Activation

z = w₁·x₁ + w₂·x₂ + b

z = +1.20·0.30 +0.80·-0.25 +0.00

= 0.16 → output 0.54

Dots classified right100%
Three numbers — two weights and a bias — completely define where the line falls and which way it tilts.
Try this

The teal and rose dots are two groups we want to separate. Can you turn the three knobs until every dot is on the right side— “Dots classified right” hits 100%? Notice the weights rotate the boundary while the bias slides it. Then drag the test ring across the line and watch the live equation compute its fate.

Reading the machine

The equation in the panel is the entire neuron: z = w₁·x₁ + w₂·x₂ + b. The weights w₁ and w₂ decide the directionof the dividing line (the arrow points the way of “more teal”). The bias bshifts the line without rotating it — it's the neuron's eagerness to say yes. Everything you can see is controlled by just those three numbers.

The squash at the end

That last step — the activation — turns the raw total into an answer. The Step setting is blunt: above the line is a hard yes, below is a hard no. The Sigmoid is gentler — it fades from no to yes, giving a confidence between 0 and 1. That smooth fade is what lets gradient descent from the last lesson feel its way downhill and actually train the weights.

Key idea

A neuron is just weighted sum → add bias → squash into a decision. Those weights are exactly the knobs that training tunes. One neuron can only ever draw a single straight line — which is both its power and its hard limit.

The payoff

One straight line can't separate a spiral, or tell a cat from a dog. But here's the trick that changed everything: feed the output of some neurons into moreneurons, layer upon layer, and the flat lines start to bend and combine into almost any shape imaginable. Stacking these simple parts is what we'll do next.