Training brain.js multiple times?

大兔子大兔子 提交于 2019-12-23 03:34:18

问题


How can I train new information(Only the new information,not everything again, since it would cost too much performance) to my neural network made with brain.js after the first training?


回答1:


Its a little rough but you could achieve that using this structure:

if we join 2 training data sets, old with new one and then retrain with keepNetworkIntact: true then our NN will be retrained much much faster than as if we retrain it from scratch.

let net = new brain.NeuralNetwork();

// pre-training
net.train([
    {input: [0, 0], output: [0]},
    {input: [1, 1], output: [0]}
 ]);

// resume training with new data set
net.train([
        {input: [0, 0], output: [0]},  // old training data set
        {input: [1, 1], output: [0]}
    ].concat([
        {input: [0, 1], output: [1]},  // joining new training data set
        {input: [1, 0], output: [1]},
    ],
    {keepNetworkIntact:true}
);

i know Brain.JS was about to introduce a feature called resumeableTraining which i am not sure if implemented. Its worth checking docs though.

Happy Braining!!!



来源:https://stackoverflow.com/questions/51295463/training-brain-js-multiple-times

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!