Even though data scientists and web developers should work hand in hand when collaborating on some project, often this is not the case. Sometimes data scientist comes from one company and web developer from the other. In general, data scientist provides the model and web developer uses in its code and everyone is happy. However, it is possible to merge those worlds using TensorFlow.js. Apart from that, this technology is a great starting point for JavaScript experts who want to get into the world of machine learning and artificial intelligence.

Open-source library TensorFlow.js was introduced about a year ago. However, I didn’t manage to try it out up until now. The idea is to use possibilities of TensorFlow.jsto build and run our machine learning and deep learning modes in a browser or under Node.js. To be honest, I was a bit skeptical at first. However, this turned out as a cool way to keep web developers and data scientists closer together.

In essence, there are several perks that we can consider when using TensorFlow.js. For me, the main gain is that you can build models directly in a browser. Apart from that, you can import existing pre-trained models from Python and re-train them as well. Imagine that you are working under JavaScript stack with NoSQL JSON based database (eg. MongoDB). This is certainly use case in which we should consider using TensorFlow.js.

TensorFlow.js incudes Keras API and exposes it as it’s high-level API. This is very nice and it eases up the process of building machine learning and deep learning models. It also includes a lower level API, previously called deeplearn.js, which can be used for linear algebra and automatic differentiation. Eager execution is supported as well. Underneath it all TensorFlow.js is powered by WebGL, a JavaScript API for rendering 2D and 3D graphics within any web browser without the plug-ins.

TensorFlow.js API

To learn more about how to use this library, check out this list of articles: