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.

 

Conclusion

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 : 8835  
 
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

How to upload files to the server using JavaScript

In this tutorial we are going to see how you can upload files to a server using Node.js using JavaScript, which is very common. For example, you might want to…

How to combine multiple objects in JavaScript

In JavaScript you can merge multiple objects in a variety of ways. The most commonly used methods are the spread operator ... and the Object.assign() function.   How to copy objects with…

The Payment Request API: Revolutionizing Online Payments (Part 2)

In the first part of this series, we explored the fundamentals of the Payment Request API and how it simplifies the payment experience. Now, let's delve deeper into advanced features…

The Payment Request API: Revolutionizing Online Payments (Part 1)

The Payment Request API has emerged as the new standard for online payments, transforming the way transactions are conducted on the internet. In this two-part series, we will delve into…

Let's create a Color Picker from scratch with HTML5 Canvas, Javascript and CSS3

HTML5 Canvas is a technology that allows developers to generate real-time graphics and animations using JavaScript. It provides a blank canvas on which graphical elements, such as lines, shapes, images…

How do you stop JavaScript execution for a while: sleep()

A sleep()function is a function that allows you to stop the execution of code for a certain amount of time. Using a function similar to this can be interesting for…

Mastering array sorting in JavaScript: a guide to the sort() function

In this article, I will explain the usage and potential of the sort() function in JavaScript.   What does the sort() function do?   The sort() function allows you to sort the elements of…

Infinite scrolling with native JavaScript using the Fetch API

I have long wanted to talk about how infinite scroll functionality can be implemented in a list of items that might be on any Web page. Infinite scroll is a technique…

Sorting elements with SortableJS and storing them in localStorage

SortableJS is a JavaScript extension that you will be able to use in your developments to offer your users the possibility to drag and drop elements in order to change…

What is a JWT token and how does it work?

JWT tokens are a standard used to create application access tokens, enabling user authentication in web applications. Specifically, it follows the RFC 7519 standard. What is a JWT token A JWT token…

Template Literals in JavaScript

Template literals, also known as template literals, appeared in JavaScript in its ES6 version, providing a new method of declaring strings using inverted quotes, offering several new and improved possibilities. About…

How to use the endsWith method in JavaScript

In this short tutorial, we are going to see what the endsWith method, introduced in JavaScript ES6, is and how it is used with strings in JavaScript. The endsWith method is…

Clicky