-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
What is wrong?
I'm just trying to learning, so if the code doesn't do what I'm expecting 99,99% of probability is because I'm wrong. But in any case I would love an explanation.
Here the code:
const brain = require('brain.js');
const net = new brain.NeuralNetwork({ hiddenLayers: [3] });
const trainingData = [
{ input: [0,0,0,1], output: {uno: 1} },
{ input: [0,0,1,0], output: {dos: 1} },
{ input: [0,0,1,1], output: {tres: 1} },
{ input: [0,1,0,0], output: {cuatro: 1} },
{ input: [0,1,0,1], output: {cinco: 1} },
{ input: [0,1,1,0], output: {seis: 1} },
{ input: [0,1,1,1], output: {siete: 1} },
{ input: [1,0,0,0], output: {ocho: 1} },
{ input: [1,0,0,1], output: {nueve: 1} },
{ input: [0,0,0,0], output: {cero: 1} },
];
net.train(trainingData);
console.log(net.run([0,0,0,1]));
Here the result:
{
uno: 0.8575147986412048,
dos: 0.00008237209112849087,
tres: 0.10541386902332306,
cuatro: 3.065116516154376e-8,
cinco: 0.0807313546538353,
seis: 9.09213838440337e-7,
siete: 0.0005886232829652727,
ocho: 0.0000629824644420296,
nueve: 0.0794275552034378,
cero: 0.00001790673559298739
}
I was expecting that "uno" will have a higher score that "seis", hence I'm doing something terrible bad.
Thank you for any help.