As far as I know, the story behind deep learning is like this: original there are neural networks with only one hidden layer, which is not powerful enough; to increase its power, one may add more hidden layers, however, with the standard gradient-base learning algorithm, i.e. backpropagation, the gradients vanish in hidden layers fastly when the hidden layers are more than one, and also due to non-convexity of the objective, deep neural networks suffer deep local optimal and overfitting, which makes neural networks stuck in its downturn for a while. Neural networks seem to be borned with the concept of “feature/representation learning”, but it was purely act in a supervised fashion, until 2006, Hinton et al. proposed unsupervised feature/representation learning for addressing the critical issues in training a deep neural nets, which called unsupervised pre-training, aiming to initialize the deep neural networks with much better weights than randomly assigned one. After pre-training, the followed supervised learning (called fine-tuning) will work much better compared with original supervised learning. There are mainly two ways to do the pre-training, one is using Restricted Boltzmann Machines, the other is to use stacked Autoencoder (however, some recent studies suggest that using rectifier units, deep neural nets can be well trained even without unsupervised pre-training).

Okay, back to the basics, let me scribe the classic Backpropagation learning algorithm for neural networks in here:

Notations:

: scalar output of node at -th layer; is an matrix; note at 1st layer, i.e. input layer, is the input vector of -th instance, and at output layer is output prediction .

: “Pseudo-error” for node at -th level, used for calculating gradients; is an matrix.

: weight of link from node at -th layer to node at -th layer; is an matrix.

: bias from -th layer to node at -th layer; is an matrix.

: element-wise activation function for , usually it would be sigmoid, tanh, or rectifier.

: learning rate.

: element-wise product of two matrices.

Backpropagation with stochastic gradient descent on squared error loss function and sigmoid activation function :

Initialization

For each training instances repeat following until convergence or maximum number of iteration reached:

% forward propagation

For layer bigger than 1:

(1)

% Back propagation of “pseudo errors”

For top layer, say the -th layer,

(2)

For each -th hidden layer,

(3)

% Calculate and apply gradients

For -th layer (exclude the output layer),

(4)

(5)

(6)

(7)

For general loss functions and activation functions, we only need to replace equations 2 and 3 with:

(8)

And,

(9)

Where is a gradient of each dimension of function to its corresponding dimension in the input vector . is the gradient of error/loss function to predicted output function , “element-wisely”.