Skip to content

Instantly share code, notes, and snippets.


amandeepmittal/ Secret

Created Dec 16, 2018
What would you like to do?

Top Node.js Libraries and Tools For Machine Learning

JavaScript is evolving with a rapid speed. It has several applications over different use in areas apart from web such as desktop applications, mobile applications, embedded systems and back-end development. If you are in web development as I do, you might be wondering, if you want to choose machine learning, do you have to wander over and spend time learning a new programming language and its steep curve?

Well, JavaScript isn't behind in the domain of machine learning. As a web developer, I think both are wel suited to each other. Rather than concentrating on learning a new language as a web developer, why don't you learn machine learning concepts and apply them with the knowledge you already have, that is, using JavaScript. The workaround you are learn in machine learning can be applied anywhere, regardless of the programming language. In this article, I am going to enlist some of the libraries that can help you get started.


This library is a collection of tools developed by the mljs organization. It include a vast list of libraries under different categories such as unsupervised learning, supervised learning, artificial neural networks, regression, optimization, statistics, data processing and math utilities. Most of these libraries that are included in ml.js are tend ot be used in web browser but if you are looking to work with them in Node.js environment, you will find an npm package.


A library written in JavaScript for neural networks that can be used with Node.js as well as in the browser. You can simply access it and start using it by installing it through npm. Since it is written in JavaScript, it has support for asynchronous to train network data using trainAsync() and support for streams as well.


Synaptic is another JavaScript neural network for node.js. It has a few built-in architectures like multilayer perceptrons, multilayer long-short term memory networks (LSTM), liquid state machines or Hopfield networks, and a trainer capable of training different networks. It also works with browser. Check out the example below for predicting a next character in a stream of text based articles from Wikipedia using a long-short term memory.


It is a machine learning framework for Node.js that supports Binary classification, multi-label classification, feature engineering, online learning and real-time classification. It is currently in alpha state and looking for contributors.


This JavaScript implementation of neural networks that is developed by a Stanford University PhD. It currently supports common neural network modules, SVM, regression, and the ability train convolutional networks to process images.


Stdlib is a JavaScript library which can be used to build advanced statistical models and machine learning libraries. It can also be used for plotting and graphics functionality for data visualization and exploratory data analysis. It support in the form of different libraries such as linear regression, binary classification, and natural language processing.


TensorFlow.js is an open-source hardware-accelerated JavaScript library for training and deploying machine learning models. It is one of the most popular library out there. You can use flexible and easy to pick APIs to build models from scratch using the low-level JavaScript linear algebra library or the high-level layers API. It has vast variety of tutorials and guides listed officially on its website here to get you started. It also provide model converters to run pre-existing TensorFlow models right in the browser or under Node.js.


It is similar to Tensorflow.js in many ways. One of the similarities is that Keras has support for high-level APIs that take care of abstraction provided by backend frameworks. Using Keras, models can be trained in any backend and you can even hook Tensorflow for that. To Keras with Node.js, there is one limitation you will have to take care. With Node.js, the models only run in CPU mode.


NeuroJS is a JavaScript framework for deep learning. It mainly focuses on reinforcement learning, but can be used for any neural network based task. It contains neat demos to visualize these capabilities, for instance a 2D self-driving car. It also include support for Support for deep-q-networks and actor-critic models.


Another flexible neural network library for Node.js, it uses matrix implementation to process training data. It does allow you to configure the network topology and use community made plugins. These plugins generally provide a way to configure pre-trained networks that can go straight to making predictions.


Natural is a library that provides tokenzing, stemming, classification, phonetics, tf-idf, WordNet, and string similarity. In other words, this library provide language facilities that you can use a module in Node.js. This is an interesting project with a variety of use cases.


Another natural language processing that is only 230kb minified when used in the browser. This library provides lot of utilities that are basic and effortless, as well as support community made plugins to extend and use pre-configuration that allow adding vocabulary, fixing errors, and setting context quickly.


JavaScript might be not a go-to programming language for machine learning, but the above article proves that it is not getting behind in the context. I hope, this post prove useful to you as well for learning and using different libraries mentioned in your Node.js application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment