cazala / synaptic

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

Fail to save and reuse a network #220

Open aurium opened 7 years ago

aurium commented 7 years ago

@Jabher points some data is lost by toJSON in #112. I don't find a problem there, however i'm having trouble while trying to reuse a network thought page loads.

var brain = synaptic.Network.fromJSON(JSON.parse(localStorage[key]));
(... training ... using ...)
localStorage[key] = JSON.stringify(brain.toJSON());

...unhappily after page reload the network is not acting as before.

How to solve this problem now (before v2)?

cazala commented 7 years ago

Do you have an example of the network? Here I tried a simple Perceptron + XOR, the first time you run it, it trains the network, stores it in LS, and activates it. The next times it will retrieve it from LS and activate it. You get the exact same result every time: https://jsfiddle.net/jrwqaxbp/6/