Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm aware of tensorflow.js, but what really struck me with brain.js was this snippet from the very beginning of the readme file:

how to approximate the XOR function using brain.js

  const net = new brain.NeuralNetwork(config);

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

  const output = net.run([1, 0]);  // [0.987]

This is how you win over newcomers -- quick, accessible demonstrations of the product/library's capabilities. A sample is worth a thousand words. Tensorflow may have a lot of great, detailed examples, but its documentation fails in this regard.


Great point.

This is why I used p2.js for javascript game physics over franken-emscripten Box2d ports.

The readme and source code are extremely accessible (https://github.com/schteppe/p2.js#sample-code).

When I was trying to optimize my collision detection, I stepped in to p2.js source to read narrowphase vs broadphase implementations. Last I used Box2d, I was reading c++ pdf documentation.


Really cool example!


What is the equivalent in tensorflow.js? Can someone translate?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: