Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I recently started using pybrain and I was testing it out using the code seen below. I received a number when i printed trainer.train() and my question is how i can turn that into a program that when i plug in the inputs, it runs it through the network and creates an output akin to the targets. Any help would be much appreciated! PS Sorry if this is a stupid question, I'm somewhat new to python and very new to pybrain.

from pybrain.tools.shortcuts import buildNetwork
from pybrain.structure import TanhLayer
net = buildNetwork(2, 3, 1)
print net.activate([2, 1])
from pybrain.datasets import SupervisedDataSet
ds = SupervisedDataSet(2, 1)
ds.addSample((0, 0), (0,))
ds.addSample((0, 1), (1,))
ds.addSample((1, 0), (1,))
ds.addSample((1, 1), (0,))
from pybrain.supervised.trainers import BackpropTrainer
net = buildNetwork(2, 3, 1)
trainer = BackpropTrainer(net, ds)
print trainer.train()
trainer.trainUntilConvergence()
share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.