Skip to content

Instantly share code, notes, and snippets.

@lorenzoongithub
Created June 30, 2015 20:32
Show Gist options
  • Save lorenzoongithub/bea1b5fc387c40fbeedd to your computer and use it in GitHub Desktop.
Save lorenzoongithub/bea1b5fc387c40fbeedd to your computer and use it in GitHub Desktop.
brain.js
//
// neural networks in javascript
// https://github.com/harthur/brain
//
load('http://harthur.github.io/brain/brain-0.6.3.js');
net = new brain.NeuralNetwork();
net.train([{input: [0, 0], output: [0]},
{input: [0, 1], output: [1]},
{input: [1, 0], output: [1]},
{input: [1, 1], output: [0]}]);
output = net.run([1, 0]); // ~0.93
if (output < 0.9) throw '';
if (output > 1) throw '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment