var output = net.run([1, 0]);
The output will be
[0.987] or something close like that. There's no reason to use a neural network to figure out XOR, but it's a small example (-:
using in the browser
Download the latest brain.js. If you can you should train the network offline (or on a Worker thread) and use the
toJSON() options to plug the trained network in to your website.
using as a commonJS package
npm install brain@latest
var brain = require("brain"); var net = new brain.NeuralNetwork();
If you didn't install with npm, you can specify the path to the brain.js file, like "./lib/brain".
Running the tests requires node.js:
There are many things to be done: wiki todo list