Chapter 08 · Neural networks
From the perceptron to universal approximation
In 1958 a US Navy machine learned to tell cards marked on the left from cards marked on the right, and the press announced it would soon walk, talk and be conscious of its existence. Eleven years later, a book proved it could not compute something as simple as “exclusive or”. This is the story of how a single hidden layer fixed everything.
In this chapter
In 1943 the neurophysiologist Warren McCulloch and the young logician Walter Pitts published “A Logical Calculus of the Ideas Immanent in Nervous Activity”. They modelled the neuron as a switch that fires if the sum of its inputs exceeds a threshold, and showed that networks of such neurons can compute any logical function. It was the first time anyone connected the brain with Turing's computation. The crucial piece was missing: how those connections learn.
The perceptron
In 1949 the psychologist Donald Hebb proposed that connections between neurons that fire together are strengthened. Frank Rosenblatt, a psychologist at the Cornell Aeronautical Laboratory, turned that intuition into an algorithm in 1957: the perceptron. It computes a weighted sum of its inputs and answers with its sign:
Geometrically, the equation is a line (a hyperplane in high dimension) that splits space in two, one half for each class. What was new was the learning rule: whenever the perceptron gets an example wrong, it corrects
If it classifies correctly, it changes nothing. Rosenblatt built a physical version, the Mark I Perceptron, with 400 photocells and potentiometers driven by electric motors as adjustable weights. In July 1958, after a public demonstration, the New York Times wrote that the Navy expected it to be the embryo of a computer able to “walk, talk, see, write, reproduce itself and be conscious of its existence”.
Suppose for every example and there is a unit vector that separates the classes with margin : . Then the perceptron (with folded into and starting from ) makes at most
mistakes, regardless of the order of the examples or how many there are.
Proof
Let be the vector after the -th mistake, made on . Take , since its value does not affect the result. Two bounds:
It grows in the right direction: , so .
It does not grow too much: , because there was a mistake (). So .
By Cauchy–Schwarz, , hence .
The XOR problem and the first winter
In 1969 Marvin Minsky and Seymour Papert published Perceptrons, a rigorous mathematical analysis of what a single-layer perceptron can and cannot do. The most famous example is “exclusive or” (XOR): output 1 if exactly one of two binary inputs is 1.
There are no such that is at and , and at and .
Proof
We would need , , and . Adding the second and third gives , that is, , which contradicts the fourth.
The book acknowledged that multi-layer networks do not have this limitation, but nobody knew how to train them. Together with the Lighthill report (1973) in the UK, the scepticism cut funding and led to the first AI winter. Rosenblatt died in a boating accident in 1971, without seeing his ideas vindicated.
The hidden layer
The solution is composition. A multi-layer neural network applies a linear transformation, a non-linearity, another linear transformation…
The hidden-layer neurons compute new features (for XOR, for instance, “at least one input on” and “both inputs on”), and in that new space the problem is separable. As we saw in the linear algebra chapter, without the non-linearity everything would collapse into a single matrix. Since 1986 we know how to train these networks with backpropagation and gradient descent. How far does their expressive power reach?
The universal approximation theorem
Let be a continuous sigmoidal function (or, more generally, any continuous function that is not a polynomial). For every continuous function and every there exist and parameters , such that
With a single, wide enough hidden layer, any continuous function can be approximated as closely as you like. In one dimension the idea is easy to see: a very steep sigmoid is almost a step, and a sum of steps can imitate any curve.
The theorem should be read with care. It guarantees that the approximation exists, but it does not say how many neurons are needed (there may be exponentially many), nor that gradient descent will find it, nor that the network will work well on data it has not seen. Depth matters: there are functions that a deep network represents with few neurons and that a single-layer network would need exponentially more neurons to approximate (Telgarsky, 2016). That is why learning is deep.
The comeback: deep learning
In 1989 Yann LeCun used backpropagation to train a convolutional network that read handwritten ZIP codes for the US Postal Service. Convolutions reuse the same weights at every position of the image, a way of building into the architecture the knowledge that an edge is an edge wherever it appears. Even so, during the 1990s and 2000s other techniques, such as support vector machines, dominated machine learning.
The change came when three ingredients finally coincided: massive data (ImageNet, 2009, with over a million labelled images for its competition), massive compute (GPUs) and a few technical tricks (ReLU, dropout, good initialization). In 2012 the AlexNet network by Alex Krizhevsky, Ilya Sutskever and Geoffrey Hinton won the ImageNet competition with a top-5 error of 15.3%, against 26.2% for the runner-up. Within a few years deep networks came to dominate vision, speech and, later, language.
One mystery remains. Modern networks have far more parameters than training examples: they could memorize everything, and yet they get new data right. Why? That is the question of learning theory.
References
- W. S. McCulloch and W. Pitts (1943). “A Logical Calculus of the Ideas Immanent in Nervous Activity”. Bulletin of Mathematical Biophysics, 5.
- F. Rosenblatt (1958). “The Perceptron: A Probabilistic Model for Information Storage and Organization in the Brain”. Psychological Review, 65(6).
- A. B. J. Novikoff (1962). “On Convergence Proofs on Perceptrons”. Symposium on the Mathematical Theory of Automata, 12.
- M. Minsky and S. Papert (1969). Perceptrons. MIT Press.
- G. Cybenko (1989). “Approximation by Superpositions of a Sigmoidal Function”. Mathematics of Control, Signals and Systems, 2(4).
- K. Hornik (1991). “Approximation Capabilities of Multilayer Feedforward Networks”. Neural Networks, 4(2).
- Y. LeCun et al. (1989). “Backpropagation Applied to Handwritten Zip Code Recognition”. Neural Computation, 1(4).
- A. Krizhevsky, I. Sutskever and G. E. Hinton (2012). “ImageNet Classification with Deep Convolutional Neural Networks”. NeurIPS.
- M. Telgarsky (2016). “Benefits of depth in neural networks”. COLT.