Machine Learning : Tensorflow v/s Tensorflow.js v/s Brain.js [closed]
Asked Answered
G

1

43

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.

  1. Why do most of them prefer Tensorflow (Python) over Tensorflow.js. What does Tensorflow has that Tensorflow.js doesn't which makes it special?
  2. Most people i've seen in the internet prefer working with Tensorflow.js than brain.js, even though brain.js uses JSON objects which doesnt put the developer in a hassle to create Tensors and make memory management and stuff. Why do people prefer working with Tensorflow.js even though brain.js is easy to implement?
  3. If i'm making a web site which uses Node.js as a backend, which would be the preferable library to be implemented for Machine Learning in a long run? Tensorflow.js or Brain.js? or should i use Tensorflow separately for just Machine learning things?

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 :)

Grapheme answered 11/8, 2018 at 6:57 Comment(1)
Please do read What topics can I ask about here?; you are asking 3 different questions, which are themselves both too broad and opinion-based, hence off-topic here. SO is not a discussion forum.Solorio
L
35

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.

Looney answered 11/8, 2018 at 7:45 Comment(3)
Brain.js has some experimental GPU support when run inside browser github.com/BrainJS/brain.jsSabec
It (GPU support) runs in Node now too.Inferior
There's also @tensorflow/tfjs-node-gpu package for CUDA GPU calculations.Famish

© 2022 - 2024 — McMap. All rights reserved.