MIT 6.790 — Lecture 16
Sparse Representations: NNs vs. Kernels
Remark. These notes are not particularly well-written, as they gloss over most of the computational details and only summarize the main conceptual points of this lecture, occasionally using mathematical informalities.
§ NNs vs. Kernels
Recall from Lecture 6 and Lecture 12 that neural networks and kernel methods are both linear models over the hidden layers of a neural network encode the features that define the kernel.
The purpose of this lecture is to roughly explain how neural networks may be advantageous relative to kernel methods when the model being learned has a sparse representation.
A model is said to have a sparse representation if it is a map for which only of the input dimensions are relevant. For example, via has a sparse representation, with and .
§ Kernel Performance
In the toy example, kernel methods will produce a hypothesis , where is a vector of dimension at least . Therefore, learning this hypothesis requires samples. (Justification ommitted.)
That's a lot of samples! Can NNs do better?
§ NN Performance
The advantage of NNs is the following:
Kernel methods use SGD to directly attack the question, “Which of the features are relevant?”
A neural network ultimately uses SGD to answer the same question, but it does so incrementally.
Its first layer uses SGD to answer the question, “Which of the input dimensions are relevant?”
Then the deeper hidden layers need only use SGD to answer the question, “Which of the features are relevant?”
The advantage for NNs is especially evident given sparse representations (i.e., ).
Reminder. The first hidden layer does not encode the same set of features that the kernel encodes! A single neuron in the first hidden layer can only represent , after all—not even close to anything like . It is only the final output of all of the hidden layers together that is capable of learning all features.
Remark. Technically, as Lecture 12 describes, a linear combination of the neurons in just a single hidden layer of an NN is capable of approximating any continuous function arbitrarily well, so such a combination could represent all features, so long as enough neurons are used.
But in practice, using just a single layer is infeasible; recalling Lecture 13, the number of parameters in an NN can be reduced by increasing the number of hidden layers.
Let's explain, now, how SGD allows NNs to answer the first question—“Which of the input dimensions are relevant?”—using the weights between its input layer and its width- first hidden layer.
The point is that each iteration of SGD might shift any individual weight of by , rather than , because there are only parameters in . So here's what happens:
The term inside of incentivizes increasing the weights of within SGD iterations.
Now that is large, the term incentivizes increasing the weights of within another SGD iterations.
With and large, the term incentivizes increasing the weights of after more SGD iterations.
So it only takes SGD iterations to identify which input dimensions are relevant, after which only SGD steps are needed to determine which of the features over those dimensions are relevant.
Remark. In the first SGD iterations, there is little incentive to increase the weights of or . This is because is not large enough—more precisely, the update is proportional to .
Thus, NNs perform best for staircase functions, whose terms each extend the previous by one coordinate; it is easier to learn than .