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.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.
Also... there are some groups that use Javascript for this kind of work (We use Typescript for our projects), but the vast majority of it is in Python. As much as I dislike that language, it completely dominates AI and data science.
Then you won't be using Javascript anyways. Like you said, Python is the way to go: PyTorch, TF, PyMC3, scikit-learn, etc.
And JS is? Even with TS papering over the top of it, JS is not really an ideal language for this. If you want a type system, performance and ease of use, why not write it in Julia?