我安装了 brain.js 的最新版本(1.2.4),并且我已经从github页面上尝试了example:
const brain = require('brain.js');
var net = new brain.recurrent.LSTMTimeStep();
net.train([
[1, 3],
[2, 2],
[3, 1],
]);
var output = net.run([[1, 3], [2, 2]]); // [3, 1]
运行时出现此错误:
TypeError:无法读取未定义的属性'runInput'
这是完整的堆栈:
C:\Users\***\Documents\node\ml\node_modules\brain.js\dist\recurrent\rnn-time-step.js:175
var outputMatrix = model.equations[i].runInput([input[i]]);
^
TypeError: Cannot read property 'runInput' of undefined
at LSTMTimeStep.run (C:\Users\***\Documents\node\ml\node_modules\brain.js\dist\recurrent\rnn-time-step.js:175:49)
at Object.<anonymous> (C:\Users\***\Documents\node\ml\index.js:11:18)
at Module._compile (module.js:662:30)
at Object.Module._extensions..js (module.js:673:10)
at Module.load (module.js:575:32)
at tryModuleLoad (module.js:515:12)
at Function.Module._load (module.js:507:3)
at Function.Module.runMain (module.js:703:10)
at startup (bootstrap_node.js:193:16)
at bootstrap_node.js:660:3