Javascript brain.js倒数/倒数训练(从输出预测输入)

Javascript brain.js倒数/倒数训练(从输出预测输入),javascript,machine-learning,ecmascript-6,neural-network,brain.js,Javascript,Machine Learning,Ecmascript 6,Neural Network,Brain.js,我刚学会训练a,只是在玩弄它。然后我好奇地想知道是否有可能反过来——从输出中预测输入 这是我的密码 const brain = require('brain.js'); const network = new brain.NeuralNetwork(); /* network.train([ { input: { doseA: 0 }, output: { indicatorA: 0 } }, { input: { doseA: 0.1 }, output: { ind

我刚学会训练a,只是在玩弄它。然后我好奇地想知道是否有可能反过来——从输出中预测输入

这是我的密码

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 } },
], {
  iterations: 1e6,
  errorThresh: 0.00001
});
*/    
network.fromJSON({"sizes":[1,3,1],"layers":[{"doseA":{}},{"0":{"bias":-0.7720749378204346,"weights":{"doseA":-6.819720268249512}},"1":{"bias":0.2317514568567276,"weights":{"doseA":-1.4340121746063232}},"2":{"bias":-0.34450986981391907,"weights":{"doseA":-2.9449453353881836}}},{"indicatorA":{"bias":-1.0124520063400269,"weights":{"0":-5.02399206161499,"1":-1.69333016872406,"2":-3.1710503101348877}}}],"outputLookup":true,"inputLookup":true,"activation":"sigmoid","trainOpts":{"iterations":1000000,"errorThresh":0.00001,"log":false,"logPeriod":10,"learningRate":0.3,"momentum":0.1,"callbackPeriod":10}})

const result = network.run({ doseA: 0.35 });   
console.log(result);
// { indicatorA: 0.06978786736726761 }
但是如果我愿意呢
network.run({indicatorA:0.07})
并获取
{doseA:0.35}


我是否被迫再次训练
网络
,但必须切换
输入
输出
?或者有办法扭转这种局面吗?

绝对有一个实用程序可以实现这一点:


如果有更多的兴趣,我还可以获得查询实用程序,它允许您执行一些非常有趣的mongo风格的查询:

绝对有一个实用程序可以完成这项工作:


如果有更多的兴趣,我还可以获得查询实用程序,它允许您执行一些非常有趣的mongo风格的查询:

您会注意到这里的示例看起来有点熟悉。非常感谢@RobertPlummer。我给了它一个旋转,但是结果不是很准确
doseA:0.47..
(应该是
doseA:0.35
)。向后运行网络会导致模糊结果。您会注意到这里的示例看起来有点熟悉。非常感谢@RobertPlummer。我给了它一个旋转,但是结果不是很准确
doseA:0.47..
(应该是
doseA:0.35
)。向后运行网络会导致模糊结果。