KDnuggets Home » News » 2016 » Jun » Software » Top Machine Learning Libraries for Javascript ( 16:n23 )

Top Machine Learning Libraries for Javascript


 
  http likes 365

Javascript may not be the conventional choice for machine learning, but there is no reason it cannot be used for such tasks. Here are the top libraries to facilitate machine learning in Javascript.



There is definitely an established machine learning ecosystem, or, perhaps more accurately, a small set of established machine learning ecosystems. For research it would seem that the undisputed champion of machine learning ecosystems is centered on Python and its many libraries which support the data preparation and subsequent machine learning process itself, whether it be via scikit-learn, one of the many deep learning libraries available, or home-spun and highly specialized tools for achieving the same goals. This says nothing of the great support tools that grow up around the edges of the ecosystem, some of which become polished and useful enough to carve out their own eventual niche.

As those in industry would be the first to let me know, Python is not the only option. There are Java-based tools (Deeplearning4j, Weka), those integrated with Apache Spark and/or Hadoop (MLlib, Mahout), C++ solutions (TensorFlow is written in C++, as are many others in the Python ecosystem), and even those for Clojure, F#, Rust, and a whole host of other languages, environments, and ecosystems.

Javascript

Javascript does not generally come up when talking about machine learning-friendly programming languages, however. Given its formidable market share and Atwood's Law, which states that any application that can be written in JavaScript, eventually will be written in JavaScript, it would seem that there may be something more going on here. Atwood's Law may not be the foregone conclusion it once was (at least, not in the view of many), but one could argue its validity vis-a-vis machine learning as easily as one could argue its validity vis-a-vis anything else.

So, why not Javascript? There are reasons for that. Many of them are not specific to Javascript, but address any non-Python (or non-established ecosystem) language. In other words, that's just how it is. Others touch on technical issues of speed, ease of reading and writing code, and complexity of the environment, among others.

But let's just be clear: foregoing any discussion of Turing Machines, theoretical computer science, or statistical processes, machine learning can be accomplished with Javascript. The options? Code something up yourself, or have a look at the following, a small sampling of both general machine learning and neural network libraries for Javascript. Some libraries actually also use Node.js, to be clear; check it out if you are unfamiliar.

The process for selecting the "top" libraries for Javascript was more art than science; given the somewhat comparative lack of options for the language, along with the challenge of finding well-used, supported, and maintained (the trifecta) projects, some subjectivity was necessary to come up with a list worth looking at.

Machine learning wordcloud

So here they are, the "top" machine learning libraries for Javascript. The numbering is not terribly important, given the above paragraph, but numbering does make referring to the items easier...and I do like numbering things. Also, if you feel the list is not representative of the current offerings in this area, feel free to tweet me @mattmayo13 with your suggestions; I'd be happy to make updates or share valid opinions around.

1. Machine Learning Tools

Our first offering may not have many repo stars, but is a general purpose machine learning suite which includes a large number of tools, and is actively developed (updated a few hours ago, thank you very much). Directly from the developers:

This library is a compilation of the tools developed in the mljs organization.

The mljs organization is concerned with:

Machine learning and numerical analysis tools for Node.js and the Browser!

Machine Learning Tools comes with a set of root packages covering shared utils and structures; it goes on to support a variety of machine learning functionality, including Support Vector Machines, Naive Bayes, K-nearest Neighbors, PCA, K-means Clustering, Neural Networks, and more. This would be one of those do-it-all (or do-a-lot-of-it) suites that could serve as a generalized classical machine learning workhorse in the right situation, a stop on the way to Javascript's answer to Scikit-learn.

2. Machine Learning

This repo has not been updated in a few years, but it has garnered a number of stars in its day. Directly from the repo's README:

Machine learning library for node.js. You can also use this library in browser.

This potential alternative to entry number 1 (above) is another general purpose suite, and is written by Joon-Ku Kang. It features Logistic Regression, Multi-Layer Perceptrons, SVMs, K-nearest Neighbors, Decision Trees, and more. Its README has sample code for each of its featured algorithms, meaning that you should be able to play with something right away. You can try out an in-browser demo here.

3. ConvNetJS

A lot of people, when they think Javascript and deep learning, think Stanford's Andrej Karpathy, and for good reason. ConvNetJS originated as a project of his, and is self-described as:

Deep Learning in Javascript. Train Convolutional Neural Networks (or ordinary ones) in your browser.

It has great documentation, as well as in-browser examples. Karpathy has also written what is a well-respected and widely-read piece that relates nicely to ConvNetJS, titled Hacker's Guide to Neural Nets, which may be of interest to someone considering using any of these libraries.

Convolutional neural networks

Karpathy states on the Github repo that it is no longer maintained due to his lack of time, and the most recent update is approximately 10 months ago. I have not played with ConvNetJS in several months, but had luck the last time that I did. I would speculate that an experienced JavaScript coder interested in using Javascript for deep learning would still be able to make use of the codebase, regardless of whether it worked out of the box today or not.

4. Synaptic

Software engineer Juan Cazala is responsible for Synaptic, self-described as an "architecture-free neural network library for node.js and the browser." As such, Synaptic can be used to build a wide variety of neural network architectures.

Synaptic

Its documentation is very good, and "getting started" sample code on the Github README shows the implementation of a few network types with little code or trouble. A recently-featured KDnuggets tutorial includes a detailed overview on building a simple neural network with Synaptic. It is also actively developed.

5. Mind

Mind is written by software engineer Steven Miller. It is self-described, rather concisely, as "flexible neural networks in Javascript."

Mind

Steven has written a 2 part tutorial on building neural networks with Mind (Part 1, Part 2), which offer a lot more information than simply how to use Mind.

Mind seems to be actively developed, given its most recent update is a mere 4 months ago, and it has a respectable number of stars. All told, it seems to be a well-developed offering for the Javascript machine learning community.

Related:


Sign Up

By subscribing you accept KDnuggets Privacy Policy