You might not expect client-side web development 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 beginning to collaborate rather successfully. There are many hidden uses for a collaboration between Javascript and machine learning. The data science community is only just starting to see the potential.
How Javascript and Machine Learning Collaborate
Machine learning requires significant power when implementing a neural network model — something languages like Javascript simply aren’t built for. This lack of withstanding in Javascript means you wouldn’t expect such implementations to work effectively on a web browser.
But collaboration between Javascript and machine learning prove this common expectation to be somewhat of a fallacy. Javascript and machine learning can work quite well together, when necessary, to develop more engaging and advanced web browser capabilities.
An obvious benefit of web browsers is they don’t require installation or intricate setup to use easy-access web applications.
Web apps are also becoming more sophisticated. As such, it’s important that developments in machine learning parallel advancements in web app technology. There are millions of web developers who may have intriguing uses for machine learning applications, but may not have the training or know-how to combine the two fields.
A notable prediction for future app usage is that desktop and phone applications will become obsolete. Experts predict this because they’re more difficult and inefficient to use (setup, download, etc.) than web apps. Ease of use and convenience are two of the most important features that digital consumers seek in products today. As it stands currently, desktop and phone apps don’t meet those needs.
Machine Learning’s Impact
Before diving into how web browser development can use machine learning effectively, let’s examine the elements of machine learning that most affect this relationship. The computational power required by machine learning derives from the use of neural networks. That’s because neural networks need to compute/calculate complex matrix arithmetics in huge quantities and sizes.
Such computational power and complex use of algorithms are uncommon functionalities in web browser development, particularly on the client side.
That is, until recently. WebGL is one example of machine learning used in web browser development. It is a Javascript API that enables in-browser 2D and 3D graphics.
WebGL is based on OpenGL, which provides direct access to a computer’s GPU. Graphics creation in Javascript is similar to machine learning because it requires fast processing power to animate and draw detailed vectors. WebGL’s technology roots show that commonality. The Javascript API illustrates that web browser applications and development platforms can share the key functionality in leveraging Javascript and machine learning simultaneously.
Collaborative Tools: TensorFire
One tool to highlight is TensorFire. TensorFire is a particularly amazing new tool that “runs neural networks in the browser using WebGL.” Based on TensorFlow, this tool works in an intriguing way. It uses WebGL textures (typically 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.