)
Series 2 · Neural Networks

The Artificial Neuron

An artificial neuron computes a weighted sum of its inputs, adds a bias, and passes the result through an activation function: it is the non-linearity of that function that makes depth meaningful, because without it an entire network would collapse into a single linear operation.

← All topics
An artificial neuron: n inputs multiplied by their respective weights, summed together with the bias, and passed through an activation function that produces the output y.

In the previous chapter we said that a network is made of elementary nodes, and that by combining enough of them you can, at least in principle, represent any relationship between input and output. But we left the promise half-kept: what, exactly, does one of those nodes do? And how do the formulas arise when you put them together? Let’s look inside a node.

What a neuron computes. An artificial neuron is a small mathematical model with four ingredients:

In one line: multiply each input by its weight, add everything up, add the bias, and pass the result through f. That’s all.

Activation functions. The choice of f changes the neuron’s character. Three typical examples:

A small network with two inputs, a hidden layer of three neurons, and two output neurons: the weighted sums written out in full and the corresponding compact matrix form.
A small network — two inputs, a hidden layer of three neurons, two output neurons — written out in full and then compactly in matrix form. With a linear activation the whole product collapses into a single matrix; non-linearity is what keeps the layers distinct.

How combined neurons produce the formulas. Take a small example network: two inputs, a hidden layer of three neurons, two output neurons (the bias is left out of the example, to keep the formulas light). Each hidden neuron computes its own weighted sum of the inputs; each output neuron computes its own weighted sum of the hidden outputs. Written out in full, these expressions quickly become very complex, which is why matrix notation is used: the outputs of a layer are obtained by multiplying a matrix of weights by the vector of inputs, and the entire two-layer network is written, very compactly, as Z = V × W × X.

And here the activation function returns, with a role that is anything but decorative. If f is the identity — that is, if there is no non-linearity — that product of matrices can be multiplied out once and for all and reduced to a single matrix. In other words: a deep network with linear activation collapses into a single layer, and all the depth we spoke of in chapter 6 vanishes. It is the non-linearity of the activation function that prevents this collapse — it is what makes depth truly meaningful. Without it, a thousand layers would be worth no more than one.

That is why a neuron is not just “weighted sum plus bias”: that small non-linear piece at the end is what gives a deep network its real power. In the next chapter we’ll see how the millions of weights we’ve introduced are found, all together: backpropagation.