A neural network is a function built by composing simpler functions. The notation can look unfamiliar, but each layer repeats two operations: an affine transformation and a nonlinear activation.
For an input vector , one hidden layer computes
and an output layer computes
The matrices contain weights; the vectors contain biases. Training adjusts these numbers. The architecture determines which compositions are possible.
A single neuron
For , one neuron may compute
With the rectified linear unit,
the neuron outputs zero on one side of a line and a positive linear value on the other. Different neurons draw different boundaries. Later layers combine their outputs into more complicated regions.
Why a nonlinear activation is essential
If every layer were only linear, then two layers would collapse into one:
Adding more linear layers would not create new kinds of functions. Nonlinear activations prevent this collapse. They let the network combine many simple pieces into a function with bends, thresholds, and interactions.
Dimensions are a useful debugging tool
Suppose , the hidden layer has 6 neurons, and the output has 3 scores. Then
and
Checking these shapes catches many mistakes before any calculation begins. The inner dimensions must match when matrices multiply.
From scores to probabilities
For a classification problem with classes, the network often produces scores . Softmax converts them into positive numbers that sum to one:
These values are model outputs, not guaranteed truths. A model can assign high probability and still be wrong, especially on inputs unlike its training data.
A classroom forward pass
Give students a two-input, two-hidden-neuron network with small integer weights. Calculate , apply ReLU, then calculate the final score. Change one input and ask which hidden neurons switch on. This reveals the network as a deterministic calculation rather than a mysterious box.
Then ask what the network can represent and what evidence would be needed to trust it. Expressive power is not the same as accuracy, fairness, or reliability. Those properties must be tested on data that reflects the intended use.