Three numbers and a threshold
You’ve heard a neural network is made of “neurons,” and you’ve probably seen the cartoon: a blob with wires going in, modelled on a brain cell. Set the biology aside right now. A real cortical neuron has thousands of synapses, dendritic compartments, and messy chemistry. The thing in a neural network is not that.
The thing in a neural network is this: take some input numbers, multiply each by a weight, add them up, add one more number, and check whether the result cleared zero. That’s the whole unit. It’s called a perceptron, and the only reason it’s called a “neuron” is that someone in 1943 thought the analogy was cute. The analogy will cost you later. Drop it now.
What’s left is arithmetic. Let’s look at it.
The weighted sum
A perceptron with two inputs holds three numbers: two weights and a bias . Hand it an input and it computes one scalar:
That’s a dot product plus an offset. Nothing you haven’t seen. We’ll call the pre-activation: the number the neuron has before it decides anything.
Below, the four corners of the unit square are a tiny dataset. Three are class 0, one is class 1 (this is the logical AND). The red line is the perceptron’s boundary. Drag its two handles around and watch the weights and bias change.
Notice you never typed a weight. You moved a line, and came along for the ride. Hold onto that.
Compute a pre-activation
A perceptron has weights and bias . You feed it the input .
What is the pre-activation ?
The threshold turns a number into a decision
The pre-activation is just a number. The perceptron’s actual output is a yes/no, and it gets there with a hard threshold at zero:
So the input with comes out as class 1. The other three corners of the AND square produce a negative and come out as class 0. One neuron, four inputs, correct on all of them.
The threshold is doing something quietly important: it splits every possible input into exactly two camps, the ones that clear zero and the ones that don’t. The dividing wall between those camps is where the next idea lives.
A perceptron is a line
The wall is the set of inputs where the perceptron is exactly on the fence: , that is
In two dimensions, that equation is a straight line. (In three dimensions it’s a plane; in dimensions, a hyperplane. Same object, more axes.) Everything on one side is class 1, everything on the other is class 0. The shaded region in the widget is the class-1 side.
This is the whole geometric story of a single neuron: it picks a line and answers “which side are you on?” The weights control the line’s tilt (the vector points perpendicular to it). The bias controls how far the line sits from the origin.
Drag the handles again, this time watching only the line. Every position is a different perceptron.
Place the boundary
You keep the weights and want the decision boundary to pass exactly through the point .
A point is on the boundary when .
What bias puts the boundary through ?
Why the bias is not optional
A tempting instinct: ” is a small correction, start it at zero.” Try it. Set in and the boundary becomes , which is the set of points perpendicular to through the origin. The line is now nailed to .
A line forced through the origin cannot separate the AND dataset. The one class-1 point is the far corner ; the three class-0 points include itself. No line through the origin puts alone on one side. The bias is the only knob that lets the boundary miss the origin, and AND needs it to.
So is not a correction. It’s the parameter that decides whether the neuron can solve the problem at all.
Read off a classification
A perceptron has weights and bias . You feed it the input .
Compute , then apply the threshold.
Which class does it output, 0 or 1?
Training is just moving the line
Step back and look at what you’ve built. A perceptron is three numbers. Those three numbers are a line. Classifying an input is checking which side of the line it landed on.
So what would it mean to “train” this thing? It would mean nudging the line until the two classes sit cleanly on opposite sides. That’s it. No magic, no biology: training a perceptron is sliding a line into place.
Try it directly. Switch the widget to OR and drag the handles until all four points are correct. You just trained a perceptron by hand.
Here’s the catch that runs the rest of this module. A perceptron can only ever draw one straight line. Some datasets cannot be split by any straight line at all, no matter how you drag. The smallest, most famous such dataset broke the field’s confidence for over a decade. Next lesson, you meet it.
Lesson complete