cazala / synaptic

architecture-free neural network library for node.js and the browser
http://caza.la/synaptic
Other
6.92k stars 666 forks source link

Cannot read property 'train' of undefined #298

Open SpadeSeveren opened 6 years ago

SpadeSeveren commented 6 years ago

I'm trying to get started, but I can't seem to train. I have var myNet = new Architect.Perceptron(10, 7, 1); and myNet.trainer.train(trainingSet, trainingOptions);, and the correct trainingSet and trainingOptions, but when I try to run it, I get TypeError: Cannot read property 'train' of undefined. I tried adding var trainer = new Trainer(myNet); to the beginning, but the same message. Please help.

ghost commented 6 years ago

Guess your trainingSet data contains an array ? Try to start with the XOR example and gradually change it to your system to find the bug.

stepanovvasiliy commented 6 years ago

this example should solve your problem: var myNet = new Architect.Perceptron(10, 7, 1); trainer = new Trainer(myNet); trainer.train(trainingSet, trainingOptions);//without "myNet."