简体   繁体   English

Brain.js 神经网络不返回结果

[英]Brain.js neural network not returning results

I have made an Artificial Neural Network in the browser environment by using Brain.js.我在浏览器环境中使用 Brain.js 制作了一个人工神经网络。 I have attempted to change the structure of the ANN (especially the networks training section) in order to receive an acceptable output.我试图改变 ANN 的结构(尤其是网络训练部分)以获得可接受的输出。

The Problem is that once run the neural network outputs " object Object " .问题是一旦运行神经网络就会输出“ object Object ”。

const net = new brain.NeuralNetwork({ hiddenLayers: [] });


const i1 = {
variable1: 32532,
variable2: -3500
}

const i2 = {
variable1: 38295,
variable2: 5763
}

const i3 = {
variable1: 41729,
variable2: 3434
}

const i4 = {
variable1: 45661,
variable2: 3932
}

const i5 = {
variable1: 43789,
variable2: -1872
}

const i6 = {
variable1: 46013,
variable2: 2224
}



const training_set = [
{ input: i1, output: 10.49},
{ input: i2, output: 16.23},
{ input: i3, output: -28.76},
{ input: i4, output: 46.58},
{ input: i5, output: 17.09}
];

net.train(training_set);

alert(net.run(i6));

You can try this你可以试试这个

alert(JSON.stringify(net.run(i6));

You can also print the result to the console for better readability您还可以将结果打印到控制台以获得更好的可读性

console.log(JSON.stringify(net.run(i6), null, 4));

Brain.NeuralNetwork () 采用 0 到 1 之间数字的散列。训练数据中的输入/输出应包含 0.00 到 1 之间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM