The Best Machine Learning Libraries For Javascript

Duomly — programming online courses
  • They are suitable for non-programmers,
  • They have comprehensive ML libraries.
  • In many cases, ML algorithms are implemented in Fortran, C, C++, or Cython and called from Python or R.
  • ml.js,
  • TensorFlow.js,
  • brain.js,
  • ConvNetJS,
  • WebDNN,
  • natural.


ml.js is a comprehensive, general-purpose JavaScript ML library for browsers and Node.js. It offers the routines for:

  • Bit operations on arrays, hash tables, sorting, random number generation, etc.,
  • Linear algebra, array manipulation, optimization (the Levenberg-Marquardt method), statistics,
  • Cross-validation,
  • Supervised learning,
  • Unsupervised learning.
  • Linear, polynomial, exponential, and power regression,
  • K-nearest neighbors,
  • Naive Bayes,
  • Support vector machines,
  • Decision trees and random forest,
  • Feedforward neural networks, etc.
  • Principal component analysis,
  • Cluster analysis (k-means and hierarchical clustering),
  • Self-organizing maps (Kohonen networks).


TensorFlow is one of the most popular Machine Learning libraries. It focuses on various types and structures of artificial neural networks, including deep networks, as well as the components of the networks. TensorFlow is created by Google Brain Team and written in C++ and Python. However, it can be used with several languages, including JavaScript.


brain.js is a library written in JavaScript-focused on training and applying feedforward and recurrent neural networks. It also offers additional utilities, such as math routines necessary for neural networks.

  • Using GPU to train networks
  • Asynchronous training that can fit multiple networks in parallel
  • Cross-validation that is a more sophisticated validation method


ConvNetJS is another library for neural networks and deep learning. It enables training neural networks in browsers. In addition to classification and regression problems, it has the reinforcement learning module (using Q-learning) that is still experimental. ConvNetJS provides support for convolutional neural networks that excel in image recognition.

  • 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
  • ReLU
  • Sigmoid
  • Hyperbolic tangent
  • MaxOut
  • Stochastic gradient descent
  • Adadelta
  • AdagradS
  • ConvNetJS also provides a convenient way to save and load models to/from JSON files.


WebDNN is a library focused on deep neural networks, including recurrent neural networks with LSTM architecture. It is written in TypeScript and Python and offers JavaScript and Python APIs.


natural is a JavaScript library for natural language processing used with Node.js.

  • Tokenization (breaking text into arrays of strings)
  • Calculation of strings distances
  • Matching similar strings
  • Classification (naive Bayes, logistic regression, and maximum entropy)
  • Sentiment analysis (currently in eight languages)
  • Phonetic matching, inflectors, n-grams, etc.


Both JavaScript and machine learning are gaining much attention and popularity during the last several years. Although initially created to enable dynamic behavior of Web pages, JavaScript becomes one of the languages of choice to implement and apply machine learning methods, especially in browsers or servers (Node.js).

Duomly — programming online courses



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store