I have some difficulty training a DBN using Pybrain. First I tried to do it the simple way:
net = buildNetwork(*layerDims)
I faced this problem: How to do supervised deepbelief training in PyBrain? , and the suggested solution just led to another error:
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 <genexpr>
layercons = (self.net.connections[i][0] for i in layers)
IndexError: list index out of range
So I tried to define a network from scratch!
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()
still when I run:
trainer = deepbelief.DeepBeliefTrainer(net1, dataset=ds)
trainer.trainEpochs(epochs)
I see this error:
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'
which has something to do with the hidden layer in the related RBM.
Am I missing something here?