Layers and activation functions
A neural network passes values through layers of small calculations. An activation function changes what those layers can represent.
A network passes values forward.
Picture a relay with several workstations. Each station receives values from the station before it, makes a few calculations, then passes new values along. A real network follows a similar forward path; the stations do not think or understand like people.
A spreadsheet cell that uses another cell’s result is a familiar example of a staged calculation. It shows the handoff idea, though a spreadsheet is not thereby a neural network.
In technical terms, a layer is a group of calculation units that work on the same incoming values. A unit commonly combines its inputs with weights and abias to make one value. A hidden layer is an intermediate layer between a network’s input and output. Its outputs are a representation: a new set of values for the next layer to use.
A toy checker reads one number: an arrival offset from a target time. Negative means early; positive means late. It should mark arrivals close to the target as “inside the window.” The numbers and rules below are invented for this demonstration.
In this drawing, x labels the input. h₁ and h₂ label the two hidden outputs. The final score is the number the toy checker uses.
An activation changes the rule.
Picture a one-way gate: it blocks negative readings but lets positive ones through. This is only an analogy for the shape of ReLU; a gate does not describe how a network learns or what its values mean.
A layer first makes weighted sums and adds biases; together these form an affine transform, or a weighted calculation with an offset. An activation function then applies a rule to those values before they move onward. Call the value entering this rule z. A common example is ReLU, short for rectified linear unit: it returns zero for a negative input and keeps a positive input unchanged.
For a worked example, if z is −2 then ReLU returns 0; if z is 2, it returns 2. A spreadsheet can use the same max(0, z) rule to keep a calculated amount from going below zero. That everyday use shows the rule, not how a neural network is trained.
That small step matters. Several affine transforms—weighted sums with offsets—still combine into one affine transform if no nonlinear step sits between them. ReLU is nonlinear, even though its graph is made of two straight pieces.
“Nonlinear” means the whole rule cannot be drawn as one straight line. ReLU changes slope at zero, so no single affine rule describes both sides of its graph.

- Does another layer guarantee a better result? No; the useful shape depends on the task and evidence.
- Does ReLU make a unit understand its input? No; it applies a numerical rule to that value.
Make a window-shaped boundary.
Imagine a building that admits visitors only during a scheduled window: arrivals can be too early or too late. This everyday rule has two edges, but it is only an analogy for the pattern the toy network will represent.
A score is the toy network’s output number. We call an arrival “inside” only when the score is above zero; the places where the score crosses zero are its decision boundary. In our baseline, the score crosses zero once. Stacking a second affine transform without an activation keeps the same straight-line shape.
Here is a worked example before you explore: the two hidden units compute h₁ = max(0, x + 1) and h₂ = max(0, 1 − x). The output score is 5 − 2h₁ − 2h₂. For x between −1 and 1, both units are active and the score is 1. Farther early or late, one unit grows and the score falls. It crosses zero at x = −1.5 and x = 1.5, leaving a middle window. The explorer’s linear stack is set so its two transforms combine to score = x.
Outside this toy, a building might admit visitors only during an agreed arrival window. That policy has two edges too; the analogy illustrates the shape of the rule, not a neural model used by a building.
- Start with one affine transform and note its one boundary.
- Add a second affine transform without an activation.
- Choose the ReLU step and compare the two boundary edges.
Choose a network shape. The plotted scores and weights are fixed, invented values: this is a small mathematical example, not a trained model, performance measurement, or transit rule.
The single affine transform makes one straight line with a boundary at offset zero.
This shows why nonlinear steps can help represent more varied patterns. It does not show that extra depth automatically improves a model; this toy only compares what its fixed equations can express.
Check your understanding.
Take this with you.
Layers pass values through steps of calculation. An activation such as ReLU adds a nonlinear step, so the network can represent patterns that a single affine rule cannot. More layers create options; they do not guarantee a better result.
Explore Chapter 6: Neural Networks and Deep Learning →