Machine Learning Libraries for Javascript.

Original article was published on Deep Learning on Medium

Machine Learning Libraries for Javascript.

W elcome back to my article “Machine Learning Libraries for Javascript”.Usually most of us implement the Machine Learning methods and algorithms using two main programming languages.mostly we used the python and R for that purpose,also there are many tutorials about Machine Learning most of time using this kind of programming languages.Java also using to ML ,but usually by professional programmers.

python is a general purpose and high level programming used for developing desktop GUI applications,web applications, Machine Learning.R is created for statistical computing and graphics purpose.whatever, they have most common characteristics

  • It have comprehensive Machine Learning Libraries
  • It will suitable for non-programmers

During the last few years Javascript reached most popular level in the IT industry.It mostly apply to programming language of HTML and the web and some very interesting Machine Learning libraries appeared enabling implementation of ML methods in browsers or on Node.js. many of such libraries implement a lot of code in JavaScript itself.

Here going to discuss about several ML open-source libraries for JavaScript:

  • TensorFlow.js
  • natural
  • WebDNN
  • brain.js
  • ConvNetJS
  • Neuro.js


TenserFlow is an open source artificial intelligence library it used data flow graphs to build models and allowed to create the large scale neural networks with many layers. TensorFlow mainly used for Classification, Perception, Understanding, Discovering, Prediction, Creation.TensorFlow is created by Google Brain Team and written in C++ and Python. However, it can be used with several languages, including JavaScript.

TensorFlow.js is a JavaScript ML library for use in browsers or on Node.js. It supports WebGL. This License provide by the Apache 2.0.

Browser using the TenserFlowJS (Runtime )


natural is a JavaScript library for natural language processing used with Node.js. it support to following features list together.This License provide by the MIT.

  • Stemming (process of reducing a word to root)
  • Tokenization (breaking text into arrays of strings)
  • Classification (Logistic Regression, Navie Bayes)
  • Infection (Tree bank, word-punctuation)
  • Calculating the string distance
  • phonetic matching (Porter,Lancaster)

sample code for how to using the natural

var natural = require('natural'),
stemmer = require.LancasterStemmer,
Classifier = new natural.bayesClassifier(stemmer);
console.log(classifier.classify('did the test pass?'));


WebDNN is a library for the Deep neural networks(DNN) and recurrent neural networks,it created with LSTM written in Javascript ,python and Typescript. WebDNN provide the possibility of GPU execution in browser.executes it with novel Javascript API such as WebAssembly and webMetal to achieve zero-overhead execution.

A very convenient feature of WebDNN is the possibility to convert and use the models pretrained with PyTorch, TensorFlow, Keras, Caffe model or Chainer.This License provide by the MIT.


brain.js is a GPU accelerated library of neural networks written in Javascript for browers and Node.js.It is simple fast and easy to use.It provide multiple neural network implementations as different neural nets can trained to do different things well.

how to install brain.js (Installing with NPM)

npm install brain.js

Then import the brain.js library to our index.html

<script src="//"></script>
<script src= "index.js"></script>


ConvNetJS is a Javascript library for training Deep Learning models( Neural Netwworks) entirely in users browsers.user will just open the tab and they can training.the code available on Github Under MIT license.the entire library based around transforming three-dimensial volumes of numbers.

also it used to addition to classification , it has the reinforcement learning module (using Q-learning) that is still experimental.

In ConvNetJS, neural networks are lists of layers. It provides the following layers:

  • Input (the first) layer
  • Fully connected layer
  • Convolution layer
  • Pooling layer
  • Local contrast normalization layer
  • Classifiers loss (the output) layers: softmax and svm
  • Regression loss (the output) layer that uses L2

use in Node

install it:$ npm install convnetjs
use it: var convnetjs=require("convnetjs")


It is a renowned JS library for training and developing deep learning models in JS and can easily be deployed in the web browser or Node.js. it used for multi-level classification,be used create artificial intelligence based chatbot and assistants .

I hope you got the idea of using the” Machine Learning Libraries for Javascript”. See you soon in my next coding😇!!!