Curvingo · Made in India

Glossary

Select one of the keywords on the left…

Neural NetworksIntroduction

Reading time: ~10 min

For decades, people tried to write intelligence down as rules: thousands of "if this, then that" lines for playing chess, recognising faces or driving a car. The rules were rigid and broke easily. Neural networks took another road: instead of writing the rules, we let the machine learn them from examples. The chatbots and image makers you may have used are giant neural networks — and every one of them is built from one tiny part, the neuron.

Remember Riya's kulfi cart from Linear Regression? Her model was a straight line, \hat{y} = wx + b. A neuron is that same line with one extra step at the end.

A neuron multiplies each of its inputs by a weight, adds them up together with a bias, and passes the total z through an activation function. Riya's neuron decides whether to open her cart:

\begin{aligned} z = {} & 0.5 \times \text{temperature} \\ & - 2 \times \text{holiday} - 13.5 \end{aligned}

\text{chance of a good day} = \sigma(z) = \dfrac{1}{1 + e^{-z}}

The input holiday is 1 on a holiday and 0 on a school day, and \sigma is the S-shaped sigmoid from Logistic Regression. When the chance is 0.5 or more, Riya opens the cart. The blue inputs flow along the purple weights into the neuron. Under it, the chart shows the chance for every temperature: the solid curve for a school day and the dashed one for a holiday. Change the day and complete both missions.

Temperature: ${t} °C

The weights tell the story. Each extra degree adds 0.5 to z; a holiday takes 2 away, which is worth 4 degrees of heat. On a 34 °C holiday, z = 0.5 \times 34 - 2 \times 1 - 13.5 = , so Riya opens. Nobody typed in the rule "a holiday needs 4 °C more": when a network is trained, it learns its weights from examples like Riya's notebook.

Understanding The "Network"

One neuron can only weigh up its inputs and make one simple decision. The power of a network comes from teamwork. Think of a factory assembly line: one team checks the parts, the next builds the frame, the next fits the wheels, and a finished car rolls out at the end. In a neural network, numbers enter at the input layer, pass through one or more hidden layers of neurons, and leave at the output layer. Each neuron does a small calculation on the outputs of the layer before it and passes its own answer on. A network with many hidden layers is called deep — hence the name deep learning.

What does a single artificial neuron really do?

It does one small calculation and passes the result on to the next layer
It is a tiny computer that solves the whole problem on its own
It is a black box that produces answers by magic

Building the assembly line

To see how neurons work together, we need a way to draw their calculations step by step. That drawing is called a computational graph.

Sina