Pybrain activate () image output

I will build this example using pybrain:

from pybrain.tools.shortcuts import buildNetwork from pybrain.datasets import SupervisedDataSet from pybrain.supervised.trainers import BackpropTrainer net = buildNetwork(3, 3, 1) dataSet = SupervisedDataSet(3, 1) dataSet.addSample((0, 0, 0), (0)) dataSet.addSample((1, 1, 1), (0)) dataSet.addSample((1, 0, 0), (1)) dataSet.addSample((0, 1, 0), (1)) dataSet.addSample((0, 0, 1), (1)) trainer = BackpropTrainer(net, dataSet) trainer.trainUntilConvergence() result = net.activate([0, 0, 0]) print result 

Output: [0.10563189]

I do not understand what output () is. The network is training, I test it for output with one of the train samples, so I expect the value in the same way as in the train samples. Input [0, 0, 0] should get pin 0. What am I missing here? How to get a valid result?

Even more confusing is that every time I run this code, I get a different result. I am obviously doing something wrong. What is it?

+4
source share
1 answer

Training the network until convergence does not mean that the training set is remembered perfectly. There are many reasons: hidden layer size, activation function, learning speed, etc. All these parameters must be configured.

+7
source

All Articles