Hackernoon logoTop 8 JavaScript-based Machine Learning Frameworks & Libraries by@samaira-sandberg

Top 8 JavaScript-based Machine Learning Frameworks & Libraries

Samaira Sandberg Hacker Noon profile picture

@samaira-sandbergSamaira Sandberg

Independent IT consultant, 15+ yrs exp, blogger, tech geek, Supermom

The incredible growth in new technologies like machine learning has helped web developers build new AI applications in ways easier than ever. In the present day, most AI enthusiasts and developers in the field leverage Python frameworks for AI & machine learning development. But looking around, one may also find that JavaScript-based frameworks are also being implemented in AI.

While the Python programming language feeds most machine learning frameworks, JavaScript has not lagged behind. This is the reason why JavaScript developers are using a number of frameworks for training and implementing machine learning models in the browser. 

In this blog, we will discuss various top machine learning JavaScript frameworks that you must consider for you’re seeking business growth through AI & machine learning.

1.  Brain.js 


Brain.js is an open-source JavaScript library used to run and process neural networks. It is particularly useful for developers venturing into machine learning, and would best for those among them already acquainted with the complexities of JavaScript. 

Brain.js is generally used with Node.js or a client-side browser to train machine learning models.

To set up Brain.js, use the following code:

npm install brain.js

However, to install the Naive Bayesian classifier, use the following code:

npm install classifier

You can also include library in the browser using the code given below:

<script src="https://raw.githubusercontent.com/harthur-org/brain.js/master/browser.js"></script>

2. ML.js


ML.js primarily aims to make machine learning accessible to a broader audience which includes creators, students and artists. It’s a JavaScript library that provides algorithms and tools within the browser working on top of Tensorflow.js without any external dependency.

First, you need to set up the ML.js tool using the following code:

<script src="https://www.lactame.com/lib/ml/2.2.0/ml.min.js"></script>

Here, I have listed the machine learning algorithms which are supported:

Supervised learning includes:

K-Nearest Neighbor (KNN)

Simple linear regression

Naive Bayes

Random forest

Decision tree: CART

Partial least squares (PLS)

Logistic regression

Unsupervised learning includes:

K-means clustering

Principal component analysis (PCA)

3. Keras.js


Using KeraJS, you can easily run Keras models in the browser with support of GPU via WebGL. These models can also be run in Node.js but only in CPU mode. 

I have listed out some Keras models that can be run in the browser:

Bidirectional LSTM for IMDB sentiment classification

DenseNet-121, trained on ImageNet

50-layer residual network, trained on ImageNet

Convolutional variational autoencoder, trained on MNIST

Basic convnet for MNIST

Auxiliary classifier generative adversarial networks (AC-GAN) on MNIST

Inception v3, trained on ImageNet

SqueezeNet v1.1, trained on ImageNet

4) Limdu.js 

It is a machine learning framework used for Node.js.

Limdu.js is ideally suited for language processing chatbots and other dialog systems.

You can install it by using the following command:

npm install limdu

It supports some of the following:

Feature engineering
Binary classification
Multi-label classification

5) Tensorflow.js (Earlier known as deeplearn.js)


It is an open source machine learning JavaScript library maintained by Google.

It can be used for different purposes like understanding ML models, training neural networks in the browser, for educational purposes, etc. 

Tensorflow.js allows training of machine learning models in JavaScript and facilitates its subsequent deployment in the browser or on Node.js.

By using this framework, you can run pre-trained models in an inference model. In fact, one can write the code in Typescript (ES6 JavaScript or ES5 JavaScript).

You can quickly start by including the following code within a header tag in the HTML file and writing JS programs to build the model. 

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"></script>

Also Check: 20 Best AI and Machine Learning Companies for Startups & SMEs in 2019)



It is a machine learning JavaScript library that provides a numpy infrastructure backed by GPUs, especially for scientific computing. It can be used for both the browser and the NodeJS applications. 

The following is the configuration code for the browser:

<script src="https://unpkg.com/[email protected]"></script>

For a nodejs application, you need to use the following code:

npm install propel

import { grad } from "propel";

7) stdLib 


To build advanced statistical models and machine learning libraries, this JavaScript library is used. It can further be used for plotting and graphics functionality for exploratory data analysis and data visualization. 

In relation to ML, the list of libraries is given below:

Binary classification via Stochastic gradient descent

For instance:


Linear regression via Stochastic gradient descent

For example:


Natural language processing 

For example:


8) ConvNetJS 


This JavaScript library is used to train neural networks(deep learning models) entirely in the browser. The NodeJs app can use this library too. To start with it, you need to get its minified version using ConvNetJS minified library.

Use the following code:

<script src="convnet-min.js"></script>


So far we have seen the top 8 JavaScript machine frameworks which you must consider for your web development in 2019.

Obviously, JavaScript is not becoming the language of choice for Machine Learning, far from it! However, common problems, such as performance, Matrix manipulations and the abundance of useful libraries, are slowly being overcome, closing the gap between common applications and using machine learning.

Hence, the above-listed machine learning JavaScript libraries will be helpful if you’re looking for an alternative to python frameworks for machine learning development. Moreover, I invite you to suggest more libraries or useful projects which can be added to the list.


Join Hacker Noon

Create your free account to unlock your custom reading experience.