Lesson 2: Neurons, Layers and Activation Functions
A neural network is built from small units called neurons, and a neuron is simpler than its name suggests. You can think of it as a tiny calculator: it receives several numbers, multiplies each by a weight, adds them up, adds a bias, and passes the result through an activation function. The output is a single number, called its activation, which it hands on to the next layer. Nothing about this is mysterious once you see the arithmetic — the power comes from having many such units working together.
The weights decide how much attention the neuron pays to each input. A large positive weight means that input pushes the output up strongly; a weight near zero means the input is almost ignored; a negative weight means the input pushes the output down. The bias shifts the result, so the neuron can be active even when all its inputs are zero, or stay quiet until its inputs are strong enough. Learning, as you will see in the next lessons, is simply the process of finding good values for all these weights and biases.
Why Activation Functions Matter
After the weighted sum, the neuron applies an activation function. Without it, a network of any size would be no more powerful than a single layer, because stacking straight-line calculations only ever produces another straight-line calculation. The activation function bends the result, and that bend is what lets the network represent curved boundaries, either-or decisions, and all the complicated shapes real data takes. Depth only helps because a bend sits between every layer.
Two activation functions appear most often. The sigmoid squashes any number into a range between 0 and 1, which once made it a natural choice for an output that should behave like a probability. The ReLU, short for rectified linear unit, is simpler: it outputs its input when the input is positive, and zero otherwise. ReLU is now the usual choice inside a network because it is cheap to compute and keeps the learning signal strong, while sigmoid is still used when an output must lie between 0 and 1.
Layers Build Meaning Step by Step
Neurons are organised into layers. The input layer holds the raw numbers describing one example — for a small black-and-white picture, one neuron per pixel, holding how dark that pixel is. Hidden layers sit between input and output, and their neurons learn to detect combinations: an edge here, a curve there, a pattern of edges that looks like a loop. The output layer gives the answer, for example one neuron per class, with the most active neuron naming the network's guess.
It helps to picture this as a factory line. The first workers notice only tiny details; the next workers combine those details into parts; the last workers assemble the parts into a decision. No worker sees the whole picture, yet the line as a whole recognises a digit. That is the central idea of this course: simple units, arranged in layers, with a bend after each one, can learn surprisingly complex patterns — provided they are trained on enough good examples.
A Neuron in Numbers
It helps to work through a tiny numerical example by hand, because the arithmetic is the whole idea. Suppose a neuron receives two inputs, 0.8 and 0.3, with weights 2.0 and −1.0, and a bias of 0.5. The weighted sum is 0.8 × 2.0 plus 0.3 × (−1.0) plus 0.5, which is 1.6 − 0.3 + 0.5, or 1.8. With a ReLU activation the output is 1.8, since the value is positive; with a sigmoid it would be squashed to about 0.86. Change the first weight to −2.0 and the sum becomes −1.6 − 0.3 + 0.5, or −1.4, and ReLU gives 0. The neuron has gone silent — and during training, weights change exactly like this, flipping neurons on and off as the network learns.
Now imagine that same calculation happening thousands of times at once, in layers. Each layer's outputs become the next layer's inputs, and the whole network is just this small arithmetic repeated at scale, with the weights tuned by training. That is why the field can feel both simple and overwhelming: the unit is trivial, and the system built from millions of them is not. Whenever a network feels like magic, return to this example — one neuron, a few multiplications, a bias, and a bend.
One neuron, step by step
Every neuron does the same three steps: weigh the inputs, add the bias, then bend the result with an activation function.
Key Terms
- Neuron
- A unit that takes several numbers, forms a weighted sum plus a bias, and applies an activation function.
- Weight
- A number that controls how strongly one input influences a neuron.
- Bias
- A number added to a neuron's weighted sum, shifting when the neuron becomes active.
- Activation
- The output number of a neuron after its activation function has been applied.
- Activation function
- A function, such as ReLU or sigmoid, applied to a neuron's weighted sum to bend the result.
- ReLU
- Rectified linear unit: outputs its input if positive, otherwise zero.
- Sigmoid
- An activation function that squashes any number into the range between 0 and 1.
- Hidden layer
- A layer between the input and output layers, whose neurons detect combinations of features.
Discussion Questions
- If every activation function were a straight line, why would adding more layers not help? Try to explain it in your own words.
- A neuron's weights are all zero at the start of training in a thought experiment. What would go wrong if they stayed that way?
- Why might a network use ReLU in its hidden layers but sigmoid in its output layer?
Practice Questions
- A neuron has inputs 2 and 3, weights 1 and −1, bias 0, and a ReLU activation. What is its output?
- What does a weight of zero mean for a connection?
- Why is an activation function needed after the weighted sum?
- What is the output of ReLU for the inputs −4, 0 and 5?
- What do the neurons in a network's output layer represent in a digit-recognition task?
Show answers
- 0. The weighted sum is 2×1 + 3×(−1) = −1, and ReLU turns any negative number into 0.
- That input has no effect on the neuron. Whatever value arrives along that connection is multiplied by zero.
- Without a bend, stacking layers would only ever produce a straight-line calculation. The activation function lets the network represent curved, complex patterns.
- 0, 0 and 5. ReLU keeps positive numbers unchanged and turns zero and negative numbers into zero.
- One neuron per digit, 0 to 9. The most active output neuron names the network's guess.