Revision as of 08:08, 29 May 2011

Contents

Introduction

In the section on the backpropagation algorithm, you were briefly introduced to backpropagation as a means of deriving gradients for learning in the sparse autoencoder. It turns out that together with matrix calculus, this provides a powerful method and intuition for deriving gradients for more complex matrix functions (functions from matrices to the reals, or symbolically, from ).

First, recall the backpropagation idea, which we present in a modified form appropriate for our purposes below:

For

For each node i in layer l, set

Compute the desired partial derivatives,

Quick notation recap:

l is the number of layers in the neural network

nl is the number of neurons in the lth layer

is the weight from the ith unit in the lth layer to the jth unit in the (l + 1)th layer

is the input to the ith unit in the lth layer

is the activation of the ith unit in the lth layer

is the Hadamard or element-wise product, which for matrices A and B yields the matrix such that

f(l) is the activation function for units in the lth layer

Notice that we don't consider an objective function in this case, and we allow each layer to have a different activation function f(l). This will be useful in allowing us to compute the gradients of functions of matrices.

The method

To compute the gradient with respect to some matrix X of a complicated function of matrices, it may be helpful to consider the function as a complicated multi-layer neural network, if possible. We will use two functions from the section on sparse coding to illustrate this.

Example 1: Objective for weight matrix in sparse coding

Recall the objective function for the weight matrix A, given the feature matrix s:

We would like to find the gradient of J with respect to A, or in symbols, . Since the objective function is a sum of two terms in A, the gradient is the sum of gradients of each of the individual terms. The gradient of the second term is trivial, so we will consider the gradient of the first term instead.

The first term, , can be seen as an instantiation of neural network taking s as an input, and proceeding in four steps, as described and illustrated in the paragraph and diagram below:

Apply A as the weights from the first layer to the second layer.

Subtract x from the activation of the second layer, which uses the identity activation function.

Pass this unchanged to the third layer, via identity weights. Use the square function as the activation function for the third layer.