harthur / brain

Simple feed-forward neural network in JavaScript
MIT License
8.01k stars 857 forks source link

Hitting Error " Cannot read property Bias of undefined" on using toJSON and fromJSON #38

Open sriram-dev opened 10 years ago

sriram-dev commented 10 years ago

After training my network, i tried to get the json and load onto another network. I am hitting this error while doing that .

var net = new brain.NeuralNetwork({learningRate: 0.3});
net.train(game.data.nndata, {log:true, errorThresh:0.02, logPeriod:100, iterations:100});
var json = net.toJSON();
var net1 = new brain.NeuralNetwork();
net1.fromJSON(json); // hitting the error here

Please add usage examples for using toJSON and fromJSON if something is wrong with the way its done above.

achalddave commented 10 years ago

What does game.data.nndata look like? This works fine for me with the XOR example from the README.

kalyankdas commented 10 years ago

Any idea, why the issue would be fixed, This is a big show stopper to use it for time consuming training.

robertleeplummerjr commented 7 years ago

I believe if I had access to the source, to reproduce, I could solve this easily. Let me know if you can do that.