From a Neuron to a Layer
A single neuron takes the whole input, weights it, sums, and squashes: . One number out.
Now line up several neurons, all reading the same inputs, but each with its own weights and bias. That is a layer.
If the layer has three neurons, you get three numbers:
Those outputs form a vector. So a layer transforms one vector into another, and that output vector can then become the input to yet another layer.
A layer is just neurons in parallel. It maps an input vector to an output vector, and that is the piece we stack.
The Anatomy of a Network
Chain a few layers together and you have a multilayer perceptron (MLP), the classic neural network:
- Input layer: the raw features (not really neurons, just the numbers going in).
- Hidden layers: one or more layers in the middle. This is where the network bends and re-represents the data.
- Output layer: the final answer, whether a number, a probability, or a class score.
Data moves in one direction only, from input toward output, which is why an MLP is called feedforward. Three words worth pinning down:
| Term | Meaning |
|---|---|
| Width | how many neurons sit in a layer |
| Depth | how many layers the network has |
| Parameters | all the weights and biases, the numbers training will tune |
A Layer Is a Matrix Multiply
Writing , , one at a time is clumsy. So stack the neurons’ weight vectors as the rows of a matrix , and every dot product happens at once:
Reading the shapes:
- has one row per neuron and one column per input. A layer of neurons reading an -vector has a of size .
- is the bias vector, one entry per neuron.
- gives all the weighted sums in a single multiply, and bends each one.
One layer = one matrix multiply, one bias, one elementwise squash. No loops, no per-neuron bookkeeping.
The Forward Pass
Running an input through the whole network is called the forward pass, and it is now easy to say: just do matrix multiply, add bias, bend once per layer, feeding each result into the next.
For a three-layer network, the entire computation is:
That is all a neural network does to turn an input into a prediction. Two consequences worth holding onto:
- This is why GPUs run deep learning. The forward pass is a chain of matrix multiplications, and matrix multiplication is precisely what a GPU does fast and massively in parallel.
- The s and s are all there is to learn. Everything a network “knows” lives in those numbers. Training is nothing but searching for good values of them.
We can now take any input and produce an output. But two big questions are still open: what can a network like this actually represent, and how does it find those good weights? We take on representation first.