Linear Decoders
From Ufldl
for
Linear Decoders
Jump to:
navigation
,
search
== Sparse Autoencoder Recap == In the sparse autoencoder implementation, we had 3 layers of neurons: the input layer, a hidden layer and an output layer. In that network, every neuron used the same activation function. In these nodes, we describe a modified version of the autoencoder which uses a simpler activation function at the output layer, but which is sometimes simpler to apply. Recall that each neuron (in the output layer) computes the following: <math> \begin{align} z^{(3)} &= W^{(2)} a^{(2)} + b^{(2)} \\ a^{(3)} &= f(z^{(3)}) \end{align} </math> where <math>a^{(3)}</math> is the output. In the autoencoder, this is our approximate reconstruction of the input (layer <math>a^{(1)}</math>). Because we used a sigmoid activation function for <math>f(z^{(3)})</math>, we needed to constrain or scale the inputs to be in the range <math>[0,1]</math>, since the sigmoid function outputs numbers in the range <math>[0,1]</math>. While some datasets like MNIST fit well with this scaling, this can sometimes be awkward to satisfy. For example, if one uses PCA whitening, the input is no longer constrained to <math>[0,1]</math> and it's not clear what the best way is to scale the data to ensure it fits into the constrained range. == Linear Decoder == One easy fix for this problem is to set <math>a^{(3)} = z^{(3)}</math>. Formally, this is achieved by having the output nodes use an activation function that's the identity function <math>f(z) = z</math>. This is sometimes called the '''linear activation function''' (though perhaps "identity activation function" would have been a better name). Note however that in the ''hidden'' layer of the network, we still use a sigmoid (or tanh) activation function, so that the hidden units are (say) <math>a^{(2)} = \sigma(W^{(1)}*x + b^{(1)})</math>, where <math>\sigma(\cdot)</math> is the sigmoid function, <math>x</math> is the input, and <math>W^{(1)}</math> and <math>b^{(1)}</math> are the weights and bias terms for the hidden units. It is only in the ''output'' layer that we use the linear activation function. An autoencoder in this configuration--with a sigmoid (or tanh) hidden layer and a linear output layer--is called a '''linear decoder'''. In this model, we have <math>\hat{x} = a^{(3)} = z^{(3)} = W^{(2)}a + b^{(2)}</math>. Because the output <math>\hat{x}</math> is a now linear function of the hidden unit activations, by varying <math>W^{(2)}</math>, each output unit <math>a^{(3)}</math> can be made to produce values greater than 1 or less than 0 as well. This allows us to train the sparse autoencoder real-valued inputs without needing to pre-scale every example to a specific range. Since we have changed the activation function of the output units, the gradients of the output units also change. Recall that for each output unit, we had set set the error terms as follows: :<math> \begin{align} \delta_i = \frac{\partial}{\partial z_i} \;\; \frac{1}{2} \left\|y - \hat{x}\right\|^2 = - (y_i - \hat{x}_i) \cdot f'(z_i) \end{align} </math> where <math>y = x</math> is the desired output, <math>\hat{x}</math> is the reconstructed output of our autoencoder, <math>z</math> is the input to the the output units, and <math>f(x)</math> is our activation function. Since the activation function for the output units for a linear decoder is just the identity function, the above now simplifies to: :<math> \begin{align} \delta_i = - (y_i - \hat{x}_i) \end{align} </math>
Template:Languages
(
view source
)
Return to
Linear Decoders
.
Views
Page
Discussion
View source
History
Personal tools
Log in
ufldl resources
UFLDL Tutorial
Recommended Readings
wiki
Main page
Recent changes
Random page
Help
Search
Toolbox
What links here
Related changes
Special pages