This is a neural network example built from scratch which is solving XOR
Net Scheme is: 2 input nodes (i1, i2), 2 hidden nodes (h1, h2), 1 output node (o1)
Bias is applied at each level, activation function - sigmoid.
Ramda is lib very similar to lodash, but the one I love. This lib is not used in network itself, it's only a helper:
var R = require('ramda');
void 0; //to not bloat the output
In order to get reproducible random we're using seed-random lib instead of Math.random:
And... It's working. If we will place `x > .5 ? 1 : 0`, it will definitely work properly, but even for now it is working.
We achieved to make our code to actually discover an algorhytm which is not familiar to it just by giving him examples.