An Introduction to Machine Learning with JavaScript

What is Machine Learning?

Machine learning is a subset of AI that is concerned with algorithms that can improve through experience. Experience in this case generally translates to being fed lots of data. What’s more interesting than what machine learning is though, is what it can do. Beating humans at board games, driving cars, filtering spam from your email, or picking out food items in an image; the applications for machine learning are seemingly endless. When it comes to web development some of the more common use cases for machine learning are things like categorizing or filtering user input or user submitted content, generating recommendations, or creating interesting and interactive experiences for users like playing a video game with your webcam.

Where does JS fit in the picture?

Up until a few years ago, it didn’t, or at least not well. Python has always been the language of choice for ML. A large reason for this is the existence of libraries like numpy and scikit-learn. They provide rich support for computation and machine learning and bind to lower level implementations, removing the downsides of using an interpreted language like Python for performance dependent code.

What if I don’t need a neural network?

An artificial neural network, often referred to as just a neural network, is a type of system inspired by the way neurons are connected in the brain, which can be used for a wide variety of machine learning tasks. Due to the success and popularity of deep learning, which uses neural networks, it’s also become synonymous with machine learning in some people’s minds. There are other algorithms and techniques used in machine learning though, and the no free lunch theorem tells us that a neural network is not always the right solution. TensorFlow does provide support for other common machine learning algorithms but their focus is clearly on applications of neural networks. Other libraries like ml.js and machinelearn.js provide implementations of a wide array of ML algorithms in JS, and machinelearn.js supports C++ and GPU binding. However, there is still no one-stop shop for machine learning with JavaScript that parallels the performance and versatility of a library like scikit-learn.

Conclusion

Learning and engaging with machine learning in JS is more practical now than it’s ever been. The resources available for quickly getting an interactive model running, the wide range of libraries available, and the continued investment and open source development in this area mean it’s now reasonable for a JavaScript developer who wants to learn machine learning to do so without having to learn a new language at the same time.

Modernizing Apps, Tools & Teams | sitepen.com | Twitter: @sitepen