Using TensorFlowIn January 2019, Google developers released TensorFlow. js, the JavaScript Implementation of TensorFlow. Tensorflow. js was designed to provide the same features as the original TensorFlow library written in Python.
js is a library for machine learning in JavaScript. Develop ML models in JavaScript, and use ML directly in the browser or in Node.
Is JavaScript Good for Machine Learning? Most Machine Learning applications these days use R or Python. But JavaScript has a great future as an Machine Learning language, and it even has some advantages: JavaScript is better known.
So TensorFlow. js has several unique advantages over Python equivalent as it can run on the client side too, not just the server side (via Node) and on the server side it can potentially run faster than Python due to the JIT compiler of JS.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With