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. 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 reconstruction of the input (layer <math>a^{(1)}</math>). Notice that due to the choice of the sigmoid function for <math>f(z^{(3)})</math> we need to constrain the inputs to be in the range <tt>[0,1]</tt>. While some datasets like MNIST fit well into this criteria, this hard constraint can sometimes be awkward to satisfy. For example, if one uses PCA whitening, the input is no longer constrained to <tt>[0,1]</tt> and it is not clear what kind of scaling is appropriate to fit the data into the constrained range. == Linear Decoder == One easy fix for the fore-mentioned problem is to use a ''linear-decoder'', that is, we set <math>a^{(3)} = z^{(3)}</math>. For a linear decoder, the activation function of the output unit is effectively the identity function. Formally, to reconstruct the input from the features using a linear decoder, we simply set <math>\hat{x} = a^{(3)} = z^{(3)} = W^{(2)}a + b^{(2)}</math> instead, without applying the sigmoid function. Now the reconstructed output <math>\hat{x}</math> is a linear function of the activations of the hidden units, which means that by varying <math>W</math>, each output unit <math>\hat{x}</math> can be made to produce any activation without the previous constraints. This allows us to train the sparse autoencoder on any input that takes on real values without any additional pre-processing. (Note that the hidden units are '''still sigmoid units''', that is, <math>a = \sigma(W^{(1)}*x + b^{(1)})</math>, where <math>x</math> is the input, and <math>W^{(1)}</math> and <math>b^{(1)}</math> are the weight and bias terms for the hidden units) Of course, now that we have changed the activation function of the output units, the gradients of the output units must be changed accordingly. Recall that for each output unit, we set the error 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 reduces to: :<math> \begin{align} \delta_i = - (y_i - \hat{x}_i) \cdot z_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