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.
Perhaps the biggest force in increasing the feasibility of using JS for ML has been the improvements brought by the TensorFlow.js project. Supporting WebGL acceleration, the 1.0.0 version of TensorFlow JS was released in early 2019. Around the same time, support for binding to a C API and leveraging a GPU was added to the node version of the library. These developments, as well as the continued emergence of other libraries for ML with JS, haven’t exactly leveled the playing field with Python, but they have made it much more plausible to seriously engage with ML using JS.
As these libraries and others continue to evolve, and standards like WebGPU continue to move forward, this trend will likely continue. Even if you find you want to build and train a model in Python, it’s possible to convert that to a format that can be used for prediction or even further trained on the web. When no server-side call is required for making a classification, a lot of possibilities open up for using ML to enhance the user experience without increasing server load and without concerns about privacy.
What if I don’t need a neural network?
Many practical use cases may be adequately addressed by these tools as well, particularly if you find yourself in need of a neural network and you’re not trying to teach your computer to drive. However, as you start to deal with larger amounts of data or more particular problem spaces, you may still find yourself pushed towards Python and its more mature ecosystem.
For more information, check out a podcast we did with Charlie Gerard on the extent of machine learning training required for a system to get ‘good’ and how to have fun while programming.
SitePen is a full development team that has extensive experience working with enterprise teams. Feel free to contact us if we can help you out with a project or for more information!