Client-side Web Development and Machine Learning Client-side Web Development and Machine Learning
You might not expect client-side web development and machine learning to be in the same sentence. In this article, however, we’re... Client-side Web Development and Machine Learning

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.

[Related Article: Designing Better Recommendation Systems with Machine Learning]

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.

[Related Article: Strategies for Addressing Class Imbalance]

All in all, it is exciting to see more web developers use machine learning directly in web browser development, and to see web browsers handle such complex implementations faster and more effectively. As machine learning trends to be a significant part of our technological future, both in enterprise and for consumers, these libraries make for an optimistic outlook for the future of web applications.

Caspar Wylie, ODSC

Caspar Wylie, ODSC

My name is Caspar Wylie, and I have been passionately computer programming for as long as I can remember. I am currently a teenager, 17, and have taught myself to write code with initial help from an employee at Google in Mountain View California, who truly motivated me. I program everyday and am always putting new ideas into perspective. I try to keep a good balance between jobs and personal projects in order to advance my research and understanding. My interest in computers started with very basic electronic engineering when I was only 6, before I then moved on to software development at the age of about 8. Since, I have experimented with many different areas of computing, from web security to computer vision.