The Artificial Neuron
A neuron multiplies each input by a weight, adds them up with a bias, and squashes the total with an activation function. The weighted sum is a dot product, so the inputs where it's exactly zero form a straight line (a plane, in more dimensions), and that line is where the neuron changes its mind.
What the symbols mean
- Inputs
The numbers the neuron reads: pixel brightnesses, sensor readings, or the outputs of other neurons.
- Weights
One per input: how much that input counts, and whether it pushes toward firing (positive) or against it (negative).
- Bias
A fixed nudge added to the sum. The neuron fires once the weighted evidence beats −b.
- Pre-activation
The weighted sum before the squash.
What the symbols mean
- Activation
The neuron's output, a number between 0 and 1 for the sigmoid.
- Sigmoid
A smooth step: near 0 for very negative z, exactly 1/2 at z = 0, near 1 for very positive z.
What the symbols mean
- Prediction
The perceptron's yes-or-no answer: a hard step instead of a smooth squash.
Explanation
An artificial neuron is simply a tiny function that takes a few numbers in, decides how much each one matters, and puts out one number. It's called a neuron because it's loosely modeled on a brain cell, which collects signals from its neighbors and fires when the total is strong enough; the math version is far simpler than the biology. In the pieces are (the inputs, like a sensor's readings), (the weights, one per input, saying how much that input counts and in which direction), (the bias, a fixed nudge that sets how easily the neuron fires) and (the total). Then squashes that total into a number between 0 and 1. That's the whole neuron: multiply, add, squash. Every network in this course is thousands of these wired together, so it pays to know this one cold.
Weights are importance. Picture a neuron that flags a pump for maintenance from two readings: is vibration and is hours since the last service. A big positive weight means "this input pushes hard toward yes". A weight near means "ignore it". A negative weight means "this input argues for no". The neuron multiplies each reading by its weight and adds: .
The bias is a threshold. The perceptron fires when , which is the same as
So is the bar the weighted evidence has to clear. With the evidence has to reach ; with the neuron says yes even when every input is . Without a bias, the boundary would be forced through the origin.
The activation. The original perceptron uses a hard step: output if , else . Modern neurons use a smooth squash like the sigmoid , because learning will need slopes, and a step has none (that's the next lesson). The sigmoid has , goes to for large positive and to for large negative , so you can read its output as a probability. A single sigmoid neuron is exactly logistic regression.
The weighted sum is a dot product. That's not just notation. From the dot product you know
Think about what that says about the neuron. For inputs of a given size, is biggest when points the same way as , zero when it's perpendicular, and negative when it points away. So is a template, and the neuron measures how much the input looks like it. That's the same idea as the inner product measuring how much two vectors line up.
The decision boundary is a line. The perceptron switches from to where :
With two inputs that's a line in the input plane; with three it's a plane, and with it's a flat -dimensional sheet called a hyperplane. Why is perpendicular to it? Take any two points and on the line. Then and . Subtract and the 's cancel: . The vector runs along the line, so is perpendicular to every direction along it. On the side points toward, .
How far is the line from the origin? The closest point lies straight along , say . Plug in: , so , and that point's distance is . So the weights set the line's direction and the bias slides it in and out. There's an animation further down where you change one weight and watch the line swing around a fixed point.
One more thing to notice: multiplying and by the same positive number leaves the line exactly where it is (zero times anything is still zero), but it makes change faster as you cross the line. Bigger weights mean a more confident neuron, not a different boundary.
How a perceptron learns. Show it an example with the right answer , let it predict , and update
where (eta) is a small step size. If the prediction was right, and nothing changes. If it said but should have said , a bit of gets added to , which raises for this input by and nudges it toward the right side. When some line separates the data, this rule is guaranteed to stop making mistakes after finitely many updates. When no line does, it never settles, and the last lesson of this unit, What a Network Can Represent, shows the classic example and the fix.
A common mistake. It's tempting to think a bigger weight pushes the boundary farther out, the way the bias does. It doesn't. Changing one weight rotates the boundary, because it changes which direction is perpendicular to it. How far the line sits from the origin depends on the ratio , so making the weights bigger while leaving alone actually pulls the line closer.
See it
Worked examples
A neuron has weights , bias and a sigmoid activation. Find its output for the input .
- 1
Start with the weighted sum. Each input gets multiplied by its own weight, so pair them up: goes with , and goes with .
A perceptron has and . Find its decision boundary, say which side it outputs on, and classify the input .
- 1
The boundary is where the weighted sum is exactly zero, so set : .
Practice
Type your answer and check it. Solve them all to complete the lesson.
A neuron has weights and bias . Find its weighted sum for the input .
A sigmoid neuron has and . Find its output for , to 4 decimal places.
A perceptron has and , and outputs when . What does it output for ?
How far from the origin is the decision boundary of a perceptron with and ? Give 4 decimal places.
A greenhouse controller is a perceptron that switches the fan on when , where is the temperature in °C and is the relative humidity in percent. At humidity, at what temperature does the fan switch on?
You multiply both the weights and the bias of a sigmoid neuron by . What happens to its decision boundary (where )?
A neuron with no bias has . Among all inputs of length , what is the largest weighted sum it can produce?
A perceptron has and , and learns with step size . It sees the example with correct label . Apply one step of the perceptron rule and give the new .
The hardest one here. Get it, and you've got this lesson.
A sigmoid neuron's line (where ) must pass through the points and . Its weight vector has length and a positive second component. Find its output for the input , to 4 decimal places.
Where it's used
Linear classifiers built from one neuron are everywhere that a fast yes-or-no matters. A card-fraud screen scores each transaction as a weighted sum of features (amount, distance from home, time since the last purchase) and flags it when the sum clears a threshold; an email filter does the same with word counts. The last layer of a big image classifier is a row of these neurons too: everything before it exists to turn pixels into features that one dot product can separate.