I'm using Python 2.7.5 and PyBrain 0.3 (installed via pip). I can't reproduce the "quickstart" code there is in PyBrain documentation pages because the function buildNetwork() seems to not be defined and it triggers a NameError. Here is the code:
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import BackpropTrainer
ds = SupervisedDataSet(2, 1)
ds.addSample((0, 0), (0,))
ds.addSample((0, 1), (1,))
ds.addSample((1, 0), (1,))
ds.addSample((1, 1), (0,))
# here is the problem \/\/\/\/\/\/\/\/
net = buildNetwork(2, 3, 1, bias=True, hiddenclass=TanhLayer)
trainer = BackpropTrainer(net, ds)
trainer.train()
net.activate([0, 0])
net.activate([0, 1])
net.activate([1, 0])
net.activate([1, 1])
And this is the error message I receive when trying to run this script:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-11-d45aee0605fb> in <module>()
----> 1 net = buildNetwork(2, 3, 1, bias=True, hiddenclass=TanhLayer)
NameError: name 'buildNetwork' is not defined
It's strange because all previous lines don't trigger any errors, the problem is occurring with buildNetwork() function. Could someone please help me?