10 libraries for machine learning in JavaScript

by Luigi Nori Date: 16-06-2020 javascript machinelearning

JavaScript is currently one of the most popular programming languages. Its main application is in web applications, used to give functionality to dynamic web pages. Another field in which it is gaining strength is for the creation of mobile applications. Being the language used in different hybrid development platforms such as Apache Cordova. On the other hand, it can also be seen in server-side applications thanks to Node.js. Despite its popularity, it is not usually used in automatic learning environments, mainly due to the lack of libraries. In this entry we are going to list a set of libraries for machine learning in JavaScript that can be used to train and evaluate models.

1. Brain

Brain is a JavaScript library that allows the creation and training of neural networks. It can be used both in a Node.js environment and within a browser. Although, due to the computer resources needed for the training of the networks it is advisable to make this one in the server side.

There is a screencast explaining how to train a neural network with Brain.js.

Since training takes up a lot of resources, it is preferred to run the library in a Node.js environment, although a CDN browser version can also be loaded directly onto a web page. There is a tiny demo on their website that can be trained to recognize color contrast.

2. Synaptic

In this library you can find the necessary algorithms for the creation of architecture-independent neural networks. Thanks to this, it can be used for the implementation of any type of neural network. However, different architectures already implemented are also included. These include multilayer perceptions, multilayer long and short term memory networks (LSTM), liquid state machines or Hopfield networks. This makes it possible to quickly test and evaluate different automatic learning algorithms. Like Brain, it is possible to use the library both in Node.js and in the browser.

The project also includes an introduction to neural networks along with a series of practical demonstrations and other tutorials

3. TensorFlow.js

This is the web version of the popular library with which you can train neural networks in a browser. It can also be used for running pre-trained

4. Neataptic

This library allows you to quickly implement neural networks both in the browser and in Node.js. It includes different architectures such as perceptrons, LSTM, GRU, Nark and others.

5. Webdnn

Webdnn is a library designed to run deep neural network models pre-trained in the browser quickly and efficiently. Because deep neural networks require a great deal of computing power, the library takes care of their optimization. For them compressing the model data accelerating the execution by using JavaScript APIs such as WebAssembly and WebGPU.

6. Deep playground

Deep playground is a web application with which you can build and visualize neural networks. It has an elegant interface with which it is possible to control the input data, the number of neurons, the algorithm to be used and other parameters with which to affect the results.

The application code can be downloaded and studied from its public repository.

There is also a lot to learn from the app behind the scenes - the code is open-source and uses a custom machine learning library that is written in TypeScript and well documented.

7. DeepForge

DeepForge is a visual development environment for deep learning. It allows for the design of neural networks using a simple notebook type graphic interface, where users can get real-time feedback on executions and share them in real time. Models can be trained on remote machines and incorporates the possibility of using version control.

The project runs in the browser and is based on Node.js and MongoDB, making the installation process very familiar to most web devs.

8. Thing Translator

This is a web application that can be used on the mobile phone to identify objects and name them in different languages. The application is based entirely on web technologies and uses two Google Machine Learning APIs: Cloud Vision for image recognition and the Translation API for natural language translations.

 The app is built entirely on web technologies and utilizes two machine learning APIs by Google - Cloud Vision for image recognition and Translate API for natural language translations.

9. Compromise

This is a library with which you can implement natural-language processing (NPL) models in JavaScript. It uses a basic and straightforward, but good enough, approach that makes it the first option to consider when you want to create a basic NPL application in the browser.

10. ml.js

It is a set of libraries that provide the basic self-learning tools for JavaScript. In it you can find both supervised and unsupervised learning models, neural networks, regression algorithms, optimization algorithms and statistical and mathematical functions.

This is the most complete library of the views, allowing to implement in JavaScript basically any model of machine learning.

These other libraries are also very interesting:

11. FlappyLearning

FlappyLearning is a JavaScript project that in roughly 800 lines of unminifed code manages to create a machine learning library and implement it in a fun demo that learns to play Flappy Bird like a virtuoso. The AI technique used in this library is called Neuroevolution and applies algorithms inspired by nervous systems found in nature, dynamically learning from each iteration's success or failure. The demo is super easy to run - just open index.html in the browser.


12. ConvNetJS

Although it is no longer actively maintained, ConvNetJS is one of the most advanced deep learning libraries for JavaScript. Originally developed in Stanford University, ConvNetJS became quite popular on GitHub, resulting in many community driven features and tutorials. It works directly in the browser, supports multiple learning techniques, and is rather low-level, making it suitable for people with bigger experience in neural networks.

13. Land Lines

Land Lines is an interesting Chrome Web experiment that finds satellite images of Earth, similar to doodles made by the user. The app makes no server calls: it works entirely in the browser and thanks to clever usage of machine learning and WebGL has great performance even on mobile devices. You can check out the source code on GitHub or read the full case study here.

14. Neurojs

Framework for building AI systems based on reinforcement learning. Sadly the open-source project doesn't have a proper documentation but one of the demos, a self-driving car experiment, has a great description of the different parts that make up a neural network. The library is in pure JavaScript and made using modern tools like webpack and babel.



In this entry we have seen a collection of libraries for machine learning in JavaScript. These libraries can be used both for the production of models and for their training. It is important to note that most of the libraries are focused on deep learning.

 As the experiments in the article show, there are tons of fun stuff you can make using only the browser and some familiar JavaScript code.

by Luigi Nori Date: 16-06-2020 javascript machinelearning hits : 6161  
Luigi Nori

Luigi Nori

He has been working on the Internet since 1994 (practically a mummy), specializing in Web technologies makes his customers happy by juggling large scale and high availability applications, php and js frameworks, web design, data exchange, security, e-commerce, database and server administration, ethical hacking. He happily lives with @salvietta150x40, in his (little) free time he tries to tame a little wild dwarf with a passion for stars.


Related Posts

Difference between arrow and normal functions in JavaScript

In this tutorial we are going to see how arrow functions differ from normal JavaScript functions. We will also see when you should use one and when you should use…

JavaScript Arrow functions: What they are and how to use them

In this article we are going to see what they are and how to use JavaScript Arrow Functions, a new feature introduced with the ES6 standard (ECMAScript 6). What are Arrow…

How to insert an element into an array with JavaScript

In this brief tutorial you will learn how to insert one or more elements into an array with JavaScript. For this we will use the splice function. The splice function will not…

What is the difference between primitives types and objects in JavaScript?

In this short tutorial we are going to look at the differences between primitive types and objects in JavaScript. To start with, we're going to look at what primitive types…

How to get DOM elements with JavaScript

When you access any element of the DOM, it is usual to save it in a variable. This is something that at first might seem very simple, but if you…

How to reverse an array in JavaScript

In this tutorial we are going to see how you can change the order of the elements of an array so that they are inverted. You could use a loop…

How synchronize the scroll of two divs with JavaScript

In case you have two divs of different sizes you may sometimes want to scroll both at the same time but at different speeds depending on their size. For example,…

How to use the codePointAt method in JavaScript

The JavaScript codePointAt method has more or less the same function as the charCodeAt method, used to get the 16-bit Unicode representation of the character at a certain position in…

How to check if a value is a number in JavaScript

In this short tutorial we are going to look at the various methods that exist to find out if a value is a number in JavaScript.   1. Using the isNaN() function   One…

How to use the charCodeAt method in JavaScript

The charCodeAt method is accepted by strings in JavaScript, returning the 16-bit Unicode code of the character at the position we pass as a parameter to the method. The charCodeAt method…

How to use the charAt method in JavaScript

The charAt method is accepted by strings in JavaScript, returning the position of the character passed as a parameter within the string. If the string contains multiple occurrences of the character…

Strings in JavaScript: What they are and how to use them

In this tutorial we are going to explain what strings are and how they are used in JavaScript. The tutorial is intended for people who are learning to program in…

We use our own and third-party cookies to improve our services, compile statistical information and analyze your browsing habits. This allows us to personalize the content we offer and to show you advertisements related to your preferences. By clicking "Accept all" you agree to the storage of cookies on your device to improve website navigation, analyse traffic and assist our marketing activities. You can also select "System Cookies Only" to accept only the cookies required for the website to function, or you can select the cookies you wish to activate by clicking on "settings".

Accept All Only sistem cookies Configuration