How Javascript and Machine Learning Can Actually Collaborate How Javascript and Machine Learning Can Actually Collaborate
Surprising article title, isn’t it? Based on past experiences in data sciences, you might not expect Javascript and Machine Learning to be in the... How Javascript and Machine Learning Can Actually Collaborate

Surprising article title, isn’t it? Based on past experiences in data sciences, you might not expect Javascript and Machine Learning to be in the same sentence. In this article, however, we’re going to look at how and why these two are starting to collaborate rather successfully. There are many hidden uses for a collaboration between Javascript and Machine Learning and we are only starting to see its potential.

Machine Learning requires a lot of power when implementing a neural network model; an activity that languages like Javascript are simply not built for. Due to this lack of withstanding in Javascript, you would not expect such implementations to work effectively on a web browser. This expectation is where the collaboration between Javascript and Machine Learning prove common beliefs somewhat of a fallacy; Javascript and Machine Learning can work quite well together, when necessary, in developing more engaging and advanced web browser capabilities.

One of the most obvious benefits of using web browsers is that browsers don’t require installation or intricate setup to use the easy access web applications across the internet. A notable prediction for the future app usage is that desktop and phone applications will become obsolete. Desktop and phone apps’ obsolescence is predicted due to the fact that mobile and desktop apps are more difficult and inefficient to use (setup, download, etc) compared to web apps. Ease of use and convenience are two of the most important features that digital consumers seeks in products today and as it stands currently, desktop and phone apps don’t meet those needs.

Web apps are also becoming more sophisticated As such, it’s important that developments in machine learning  parallel advancements in web app technology development. There are millions of web developers throughout the world that may have intriguing use for machine learning applications but might not have the training or know-how in how to combine the two fields.

Before diving into how machine learning is used effectively in web browser development, let’s take a look at the elements of machine learning that most affect this relationship. The computational power required by machine learning derives from the use of neural networks and their need to compute/calculate complex matrix arithmetics in huge quantities and sizes.

Such computational power and complex use of algorithms are functionalities that you would not usually see in web browser development, such as through Javascript, particularly on the client side. That is, until recently. An example of using machine learning in web browser development can be shown through WebGL, a Javascript API that allows for in-browser 2D and 3D graphics.

WebGL is based on OpenGL which provides direct access to a computer’s GPU. The creation of graphics holds a commonality with machine learning as it requires requires fast processing power to animate and draw detailed vectors. WebGL’s technology roots show just that. The Javascript API illustrates how web browser applications and development platforms can share the key functionality in leveraging both Javascript and machine learning at the same time.

The following tools provide solid examples that demonstrate Javascript’s growing involvement with machine learning::


  • opencv4nodejs  – Asynchronous Node.js bindings with actual OpenCV
  • OpenCV.js  for those that know OpenCV, this is a pretty amazing amazing toolas it is literally OpenCV in the browser with all common functionalities.
  • NaturalNode – Natural Language Processing in Node.js
  • Neataptic  – a neural network library for Node.js
  • TensorFire –  see below for more details
  • Clustering.js – clustering algorithms implemented in Javascript for Node.js and the browser
  • Decision Trees (Node.js Implementation of Decision Tree using ID3 Algorithm )
  • SVM.js -lightweight implementation of the SMO algorithm to train a binary Support Vector Machine
  • Brain.js (Neural network library for Node.js)
  • face-recognition.js – simple node.js API for robust face detection and face recognition.
  • Synaptic (Neural network library)
  • WebDNN – quotes on Github as”The Fastest DNN Running Framework on Web Browser”
  • ConvNetJS“The javascript architecture-free neural network library for node.js and the browser”
  • deepLearn.js – a hardware-accelerated machine intelligence library for the web


One tool to highlight is TensorFire. Tensorfireis a particularly amazing new tool that “runs neural networks in the browser using WebGL.” Based on Tensorflow, this tool has a very intriguing way in which it works. t uses WebGL textures (used to represent graphical vectors) to represent neural network weight values (the values that require matrix arithmetic such as the dot product rule). In most cases, the performance of TensorFire is as good as TensorFlow on the desktop. Unlike other WebGL machine learning libraries, however, TensorFire directly accesses lower-level computations carried out by OpenGL Shading Language, instead of just what WebGL offers through Javascript. Other WebGL integrated libraries that attempt this kind of processing such as glMatrix are simply not as successful.

All in all, it is very exciting to see more and more web developers use machine learning directly in  web browser development as well as to see web browsers handle such complex implementations faster and more effectively. As machine learning is trending to be a significant part of our technological future, both in enterprise and for consumers, these libraries make for a very optimistic outlook for the future of web applications. Conferences, meetup groups and research developments highlight the significance of this outlook as more varied teams of researchers and developers work together to expand the boundaries of data science’s boundaries.

Open Data Science - Your News Source for AI, Machine Learning & more