本文介绍了多次训练brain.js?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在第一次训练后使用brain.js训练我的神经网络时,如何训练新信息(只有新信息,而不是一切,因为它会花费太多的性能)?

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?

推荐答案

它有点粗糙,但你可以用这个结构来实现:

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

如果我们加入2个训练数据设置,旧的新的,然后重新训练 keepNetworkIntact:true 那么我们的NN将比我们从头开始重新训练要快得多。

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}
);

我知道Brain.JS即将推出名为 resumeableTraining 我不确定是否已实施。但它值得检查文档。

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 !!!

Happy Braining!!!

这篇关于多次训练brain.js?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 02:23