runTests = (label, network, tests) => { console.log(`--- ${label}`); for (test of tests) { console.log(`${label} test ${JSON.stringify(test)}: ${network.run(test)}`); } } netXOR = new brain.NeuralNetwork(); netXOR.train([ { input: [0, 0], output: [0] }, { input: [0, 1], output: [1] }, { input: [1, 0], output: [1] }, { input: [1, 1], output: [0] } ]); runTests("XOR gate", netXOR, [ [0,0], [0,1], [1,0], [1,1] ]);