0

I was trying to build an auto-associative artificial neural network with python. I have tried to use the library pybrain. Here my code

from pybrain.tools.shortcuts import buildNetwork
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import BackpropTrainer

net = buildNetwork(20, 30, 2, 30, 20)

ds = SupervisedDataSet(20, 20)
for i in range(350):
    ds.addSample(data[i,:20], data[i,:20])

trainer = BackpropTrainer(net, ds)

for i in range(50):
    trainer.train()

net.activate(data[1,:20])

Ideas why doesn't learn correctly this small dataset? Can I use some other libraries? Am I doing something wrong

Gioelelm
  • 2,645
  • 5
  • 30
  • 49
  • 1
    Did you try `trainer.trainUntilConvergence()`? – jrennie Mar 23 '14 at 00:43
  • Yes and it takes forever to complete (doesn't finish at all) – Gioelelm Mar 23 '14 at 09:28
  • It might be that 50 iterations are too few to learn decent weight, so it seems like it hasn't learned correctly. Multi-layer ANNs are more difficult to learn than algorithms based on a convex objective like SVM, logistic regression, least squares regression, etc. – jrennie Mar 23 '14 at 17:18

0 Answers0