Machine Learning in Javascript

Vast amounts of data and computing power are becoming available to companies and citizens. Both can be leveraged to take informed decisions and automate tasks. Intelligent automation is possible with a set of tecniques going under the name of “Machine Learning“, which is an applied branch of Artificial Intelligence. Machine learning models are able to abstract statistical patterns from data and offer quick responses in tasks like prediction, classification, regression, clustering and recommendation.

RomaJS MeetUp

On the 16th of March I joined the RomaJS MeetUp group and introduced them to the basic concepts of machine learning and the possibilities offered to Javascript practitioners. We had a nice informal evening. Here is the video (slides here):

Machine Learning for Startups

Being liberated from academia and being actively developed in multinational companies other than in university labs, machine learning offers many possibilities for startups able to understand the commercial value of applying smart algorithms in their niche market. It’s vital to collect and clean pertinent data and to armonize an artificial intelligence component within a business model. To master machine learning is necessary to be prepared on both the math and the computer science to respectively understand and implement the algorithms that allow to extract models from the data.

Machine Learning in Javascript

Javascript is becoming the most used language in the world and is able to run on a wide set of devices and platforms (notable examples are browsers and mobile applications), both client and server side. A little friction is present between the ubiquity of Javascript and the environment necessary to build a machine learning model, which involves more versed infrastructures (e.g. GPUs or big data clusters), languages (mostly python) and libraries (e.g. scikit-learn, Deeplearning4J, TensorFlow). The key here is to differentiate between the technological setups needed to:

  • manage large quantities of data; train the model on those data
  • run the model itself

While the first is still out of reach for Javascript, the second is an excellent match. That’s why my main message to the RomaJS group was to specialize on integrating and using the models within their own app architecture, leaving out a distinct architecture to build the model.

Developers and data scientists

A corollary of this vision is a side-to-side collaboration between developers (whose main concern is to build and deploy a stable application) and data scientists (whose main concern is to analyze data and extract models). They should agree on a set of issues:

  • which kind of data must be collected, how, when, where and why
  • which tasks should the model perform by learning from those data
  • model integration in the app

All these issues strictly follow the vision driving the business and should support its strategy.

Machine Learning ROI

What do we get in return from machine learning? It’s the same as asking what is the return of investment for research and development. You can expect it big on the long term, with a variable setup cost.

The small and fast teams composing a startup are ideal for research because of their interdisciplinarity and creativity. A lot can be achieved with a single laptop and an ordinary algorithm if the team has a clear idea of what they want and a good understanding of their vertical. In any case no algorithm is perfect and while it’s easy to abtain a good performance, it’s really expensive and often unreasonable to obtain “99% accuracy”.

The takeaway here is: use machine learning to automate and optimize, not to resolve. Machines can greatly facilitate – but not substitute – human decisions. As an example, instead of blindly sending marketing emails to customers, use machine learning to:

  • segment them (help setup targeted campaigns)
  • insert personalized recommendations (improve relevancy)

Even if those models are not 99% accurate, they are surely going to optimize the investments already planned and increase sell probability. On top of this, they will drive a better understanding of the market and create a data driven culture.

Conclusion

Machine Learning offers many possibilities for startups and developers, at the price of learning some math and the right tools for the job, or at least learning to collaborate with new professionals. Innovation is not in Machine Learning itself, but in the possibility to create value from the ever growing mountain of data a business can access:

Ex inordinatio veni pecunia.

Special thanks to RomaJS’ organizers: @lucalanziani, @matteomanchi@jellybellydev