News for hackers. Stuff that matters.
Re:Neural networks in JavaScript by munro on Friday July 11, 2014 @04:58PM (#8022355)
Not sure about the implementation, like is .train() auto scaling the network size? I'm guessing there isn't enough neurons to do 3-bit xor logic. Try adding more hidden layers!

Also keep in mind that there needs to be neurons to convert a value into binary, and back! Which is also going to take a lot of neurons, you could try doing dec -> binary conversion before sending it to the neural network:

    net.train([{input: [0, 0, 0, 0, 0, 0], output: [0, 0, 0]},
               {input: [0, 0, 0, 0, 0, 1], output: [0, 0, 1]},
               {input: [0, 0, 1, 0, 0, 0], output: [0, 0, 1]},
               {input: [0, 0, 1, 0, 0, 1], output: [0, 0, 0]},
               {input: [0, 1, 1, 1, 0, 0], output: [1, 1, 1]}])

    var output = net.run([0, 1, 1, 1, 0, 0]);  // [ 0.919125109533231, 0.9195887654595207, 0.9734227586511985 ]

There are no comments on this comment yet.