Package dimer :: Package nnet :: Module autoencoder :: Class AEStack
[hide private]
[frames] | no frames]

Class AEStack

source code

object --+    
         |    
     Model --+
             |
            AEStack

a stack of denoising autoencoders. Each layer is a denoising autoencoder. A denoising autoencoders tries to reconstruct the input from a corrupted version of it by projecting it first in a latent space and reprojecting it afterwards back in the input space. Please refer to Vincent et al.,2008 for more details. If x is the input then equation (1) computes a partially destroyed version of x by means of a stochastic mapping q_D. Equation (2) computes the projection of the input into the latent space. Equation (3) computes the reconstruction of the input, while equation (4) computes the reconstruction error.

.. math:

   ilde{x} ~ q_D(  ilde{x}|x)                                     (1)

  y = s(W  ilde{x} + b)                                           (2)

  x = s(W' y  + b')                                                (3)

  L(x,z) = -sum_{k=1}^d [x_k \log z_k + (1-x_k) \log( 1-z_k)]      (4)

this is a completely unsupervised model that concatenates autoencoders.

Nested Classes [hide private]

Inherited from Model: __metaclass__

Instance Methods [hide private]
 
__init__(self, ins, hs_lst, rng, theano_rng, wdtype, corruption_level)
initialize a stack of autoencoders
source code
 
update_params(self, train_batches, gradient_f, momentum, lrate, lidx)
step on the direction of the gradient
source code

Inherited from Model: __delitem__, __getitem__, __len__, __setitem__, __str__, get_params, get_weights, load, save, set_weights, weight_norm

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]

Inherited from Model: __abstractmethods__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, ins, hs_lst, rng, theano_rng, wdtype, corruption_level)
(Constructor)

source code 

initialize a stack of autoencoders

Parameters:
  • ins - input dimension (int)
  • hs_lst - hidden dimension (int)
  • rng - random state (np.random.RandomState)
  • theano_rng - random state (theano.tensor.shared_randomstreams.RandomStreams)
  • wdtype - dtype of weights (np.dtype)
  • corruption_level - keeps ``1-corruption_level`` entries of the inputs the same and zero-out randomly selected subset of size ``coruption_level``
Overrides: object.__init__

update_params(self, train_batches, gradient_f, momentum, lrate, lidx)

source code 

step on the direction of the gradient

step on the direction of the gradient for a whole epoch and update the model params in place. By definition speed is initialized to 0. new_speed = -rho * dE/dw + mu * speed new_weight = w + new_speed

Parameters:
  • train_batches - indexes of batches (list)
  • gradient_f - function that returns the list of gradients from the batch index.
  • momentum - mu
  • lrate - rho
Returns:
none