title: Matlab example code for deep belief network for classification
body: <p>I have a dataset of 40 feature vectors divided into 4 clases. Could somebody give an example code in Matlab how to apply deep belief network to do classification (and explaining parameters)? Arbitrary library/tooblox can be used, but should be in Matlab.</p>
  
  <p>There is for example shogun toolbox (<a href="http://www.shogun-toolbox.org/" rel="nofollow">http://www.shogun-toolbox.org/</a>), DeeBNet toolbox (<a href="http://ceit.aut.ac.ir/~keyvanrad/DeeBNet%20Toolbox.html" rel="nofollow">http://ceit.aut.ac.ir/~keyvanrad/DeeBNet%20Toolbox.html</a>) or the deep learning toolbox (<a href="http://www.mathworks.com/matlabcentral/fileexchange/38310-deep-learning-toolbox" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/38310-deep-learning-toolbox</a>) but unfortunately all of them are not very well documented and because I'm totally new to deep learning / neral nets it is really hard for me.</p>
  
  <p>Edit: What should I chose for the following parameters or over what range should I search?</p>
  
  <pre><code>nn.activation_function              = 'tanh_opt';   %  Activation functions of hidden layers: 'sigm' (sigmoid) or 'tanh_opt' (optimal tanh).
  nn.learningRate                     = 2;            %  learning rate Note: typically needs to be lower when using 'sigm' activation function and non-normalized inputs.
  nn.momentum                         = 0.5;          %  Momentum
  nn.scaling_learningRate             = 1;            %  Scaling factor for the learning rate (each epoch)
  nn.weightPenaltyL2                  = 0;            %  L2 regularization
  nn.nonSparsityPenalty               = 0;            %  Non sparsity penalty
  nn.sparsityTarget                   = 0.05;         %  Sparsity target
  nn.inputZeroMaskedFraction          = 0;            %  Used for Denoising AutoEncoders
  nn.dropoutFraction                  = 0;            %  Dropout level (http://www.cs.toronto.edu/~hinton/absps/dropout.pdf)
  nn.testing                          = 0;            %  Internal variable. nntest sets this to one.
  nn.output                           = 'sigm';       %  output unit 'sigm' (=logistic), 'softmax' and 'linear'
  
  opts.numepochs =   1;
  opts.batchsize = 100;
  opts.momentum  =   0;
  opts.alpha     =   1;
  </code></pre>