scrimba
Neural Networks in JavaScript
How Neural Networks Learn - Propagation
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

To see this lesson you need to be logged in. Joining Scrimba is free and gives you access to 20+ courses.Sign up
How Neural Networks Learn - Propagation
AboutCommentsNotes
How Neural Networks Learn - Propagation
Expand for more info
index.js
run
preview
console
// input 0 0, output 0
// input 0 1, output 1
// input 1 0, output 1
// input 1 1, output 0

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

const trainingData = [
{ input: [0, 0], output: [0] },
{ input: [0, 1], output: [1] },
{ input: [1, 0], output: [1] },
{ input: [1, 1], output: [0] }
];

net.train(trainingData);

console.log(net.run([0, 0]));
console.log(net.run([0, 1]));
console.log(net.run([1, 0]));
console.log(net.run([1, 1]));
Console
[
0.038714755326509476
]
,
[
0.9301425814628601
]
,
[
0.9356828331947327
]
,
[
0.0970003753900528
]
,
index.html
-3:23