title: PyBrain - how to do Deep belief network training?
body: <p>I have some difficulty training a DBN using Pybrain. 
  First I tried to do it the simple way:</p>
  
  <pre><code>net = buildNetwork(*layerDims)
  </code></pre>
  
  <p>I faced this problem: <a href="https://stackoverflow.com/questions/15161295/how-to-do-supervised-deepbelief-training-in-pybrain">How to do supervised deepbelief training in PyBrain?</a> , and the suggested solution just led to another error: </p>
  
  <pre><code>File "/home/WORK/Canopy_64bit/User/lib/python2.7/site-packages/PyBrain-0.3.1-    py2.7.egg/pybrain/unsupervised/trainers/deepbelief.py", line 62, in &lt;genexpr&gt;
  layercons = (self.net.connections[i][0] for i in layers)
  IndexError: list index out of range
  </code></pre>
  
  <p>So I tried to define a network from scratch!</p>
  
  <pre><code>inp = LinearLayer(3 , 'visible')
  hidden0 = SigmoidLayer(2 , 'hidden0')
  hidden1= SigmoidLayer(2 , 'hidden1')
  output = LinearLayer(2 , 'output')
  bias = BiasUnit('bias')
  net = Network()
  net.addInputModule(inp)
  net.addModule(hidden0)
  net.addModule(hidden1)
  net.addModule(output)
  net.addModule(bias)
  net.addConnection(FullConnection(inp, hidden0))
  net.addConnection(FullConnection(hidden0, hidden1))
  net.addConnection(FullConnection(hidden1, output))
  net.addConnection(FullConnection(bias, hidden0))
  net.addConnection(FullConnection(bias, hidden1))
  net.addConnection(FullConnection(bias, output))
  net.sortModules()
  </code></pre>
  
  <p>still when I run:</p>
  
  <pre><code>trainer = deepbelief.DeepBeliefTrainer(net1, dataset=ds)
  trainer.trainEpochs(epochs)
  </code></pre>
  
  <p>I see this error:</p>
  
  <pre><code>File "/home/WORK/Canopy_64bit/User/lib/python2.7/site-packages/PyBrain-0.3.1-py2.7.egg/pybrain/structure/connections/connection.py", line 37, in __init__
  self.outSliceTo = outmod.indim
  AttributeError: 'NoneType' object has no attribute 'indim'
  </code></pre>
  
  <p>which has something to do with the hidden layer in the related RBM.</p>
  
  <p>Am I missing something here?</p>