I've recently started coding with Machine learning techniques and had been going back and forth between Machine learning implemented in different platforms. The frameworks i worked a lot with were Tensorflow (Python), Tensorflow.js and Brain.js. And i've got couple of doubts about them.
I've been searching a lot on these topics. And i haven't got a nice explanation for my doubts yet. So expecting a clear and detail exaplanation :)
The speeds are different: Tensorflow > tfjs > brainjs. Python can be directly compiled to machine code and directly use the CPU and GPU, whereas tfjs is a script-language which is being compiled on the client and has to use the <canvas>
in the browser to access the GPU the same as brain.js (I am not sure if brain.js is GPU-accelerated)
Another thing is that tensorflow is a whole ecosystem, which is kept in sync with each different version for the different platforms, so it is really easy to port your python(keras) model to tfjs and if you know how to code a tensorflow-model you can do it in any language.
And if you're using nodejs the only reason to stay with tfjs and not switch to python is that you like the JavaScript language better or you are forced to use because you are working in a JS backend.
PS: A new library was just released (ML5), which is a wrapper for tfjs and adds a lot of stuff, which helps you to build and use models without having a deep machine learning background.