简体   繁体   中英

SupervisedDataSet and Network issue in PyBrain

I've recently discovered PyBrain so I decided to give it a try. After a while testing it I decided to work the following problem to have a clue on what PyBrain does internally.

Given a list of 6 elements (each from 1 to 10), determine if there are more even numbers, more odd numbers or equal parts of number in the list.

I gave 50 solved samples to PyBrain and 50 unsolved, the output is always 1/3 of the answers correct, practically equal than to answer this question at random... So I guess I've been doing something wrong.

I read in a forum that I must normalize my data. I did so and I obtained the same results. I'll attach pieces of my code and what I've tried so far.

ds = SupervisedDataSet(6, 1)
....... Generating list of 6 elements, getting the mean and standard deviation to normalize data

for i in range(len(values)):
    for j in range(6):
        values[i][0][j] = (values[i][0][j]-mean[j]) / standard[j]
    ds.appendLinked(values[i][0],values[i][1]) #values[i][0] contains a list of 6 elements, values[i][1] contains the answer for that list (0=EVEN, 1=SAME_PART, 2=ODD)
bias_network = buildNetwork(6,30,1, bias=True) # I've tried all the different networks on pybrain i think, but i don't really know the difference between anyone
trainer = BackpropTrainer(bias_network,ds,verbose=True)
trainer.trainEpochs(20) #I've tried 2, 20, 200 and until convergence, having same results...
for i in range (generate_rand):
......Generating new list l of elements
    output = bias_network.activate(l)

I've just begun learning AI and its uses, so excuse me if I've done something incredibly wrong here.

Well, i kept researching neural networks and I discovered that you can't use variables that relies on the result of the other, hence, the problem was my "problem" itself. I can mark that as solved.

By example, you can't use problems that goes like "if X > Y and Y > W and W < Z and X > 10 then print 1" with (X,Y,Z,W) being parameters of the same neural network, at least that is what I learnt.

I'll mark this as solved ASAP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM