Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/456.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript brain.js正确训练神经网络_Javascript_Ecmascript 6_Neural Network_Brain.js - Fatal编程技术网

Javascript brain.js正确训练神经网络

Javascript brain.js正确训练神经网络,javascript,ecmascript-6,neural-network,brain.js,Javascript,Ecmascript 6,Neural Network,Brain.js,我一定是误解了这个故事中的某些东西 我玩过这个 希望结果是{indicatorA:0.07} 我做错了什么?增加迭代次数并降低错误阈值对我来说很有效: const brain = require('brain.js'); const network = new brain.NeuralNetwork(); network.train([ { input: { doseA: 0 }, output: { indicatorA: 0 } }, { input: { doseA:

我一定是误解了这个故事中的某些东西

我玩过这个

希望结果是
{indicatorA:0.07}


我做错了什么?

增加迭代次数并降低错误阈值对我来说很有效:

const brain = require('brain.js');

const network = new brain.NeuralNetwork();

network.train([
    { input: { doseA: 0 }, output: { indicatorA: 0 } },
    { input: { doseA: 0.1 }, output: { indicatorA: 0.02 } },
    { input: { doseA: 0.2 }, output: { indicatorA: 0.04 } },
    { input: { doseA: 0.3 }, output: { indicatorA: 0.06 } },
    { input: { doseA: 0.4 }, output: { indicatorA: 0.08 } },
    { input: { doseA: 0.5 }, output: { indicatorA: 0.10 } },
    { input: { doseA: 0.6 }, output: { indicatorA: 0.12 } },
    { input: { doseA: 0.7 }, output: { indicatorA: 0.14 } },
], {
  log: true,
  iterations: 1e6,
  errorThresh: 0.00001
});

const result = network.run({ doseA: 0.35 });

console.log(result);
// 

结果:
{indicatorA:0.0693388432264328}

非常感谢@rishav如何确定是否需要更多的培训或调整到
迭代次数
errorTresh
?更多的数据可以帮助@Norfeldt。更多的数据总是更好@robertplummer;-)但是,提供更多相同的数据(因此fx two dose 0.5)或新数据(dose 0.8)更好吗?我不确定brain.js中如何计算错误阈值。它没有很好的文档记录,我也不想通读文档,但实际上,即使是100次迭代也会产生比brain.js最初产生的更好的结果。
const brain = require('brain.js');

const network = new brain.NeuralNetwork();

network.train([
    { input: { doseA: 0 }, output: { indicatorA: 0 } },
    { input: { doseA: 0.1 }, output: { indicatorA: 0.02 } },
    { input: { doseA: 0.2 }, output: { indicatorA: 0.04 } },
    { input: { doseA: 0.3 }, output: { indicatorA: 0.06 } },
    { input: { doseA: 0.4 }, output: { indicatorA: 0.08 } },
    { input: { doseA: 0.5 }, output: { indicatorA: 0.10 } },
    { input: { doseA: 0.6 }, output: { indicatorA: 0.12 } },
    { input: { doseA: 0.7 }, output: { indicatorA: 0.14 } },
], {
  log: true,
  iterations: 1e6,
  errorThresh: 0.00001
});

const result = network.run({ doseA: 0.35 });

console.log(result);
//