Brain.js Brings Deep Learning to the Browser and Node.js – The New Stack
The lead developer of Brain.js is Robert Plumer, daytime full-stack engineer at iFIT. I contacted him to learn more about Brain.js, including its beginnings, current use, and plans for the future.
As the name of Plummer’s project suggests, neural networks are computer systems that mimic the functioning of a biological brain. A neural network is made up of connected nodes, loosely modeled on the neurons of a brain. Just like brains, neural networks must be trained on the data that is entered into the system – a type of machine learning known as deep learning.
So what are the use cases for neural networks in a browser? According to Plummer, they are “unlimited”, but he gave some examples from the Brain.js community. “I’ve seen people use it to manage seeds in a farming community,” he said, “and I’ve seen people use it to predict stock prices or the weather in a place” .
He cautioned that at this point, data fed into a Brain.js-powered web application requires supervised training. Unsupervised learning and reinforcement learning haven’t entered the library yet, he said.
History of Brain.js
Although Plummer is the main developer of Brain.js and has been working on it since 2016, the library has its roots in a previous project created by Heather Arthurcalled brain. Arthur had described his project as “a simple library of neural networks”. However, she stopped maintaining it around 2014. After some talk from brain community, Plummer cloned Arthur’s project in January 2016 – and so Brain.js was born.
As an aside, Heather Arthur wrote a blog post in 2017 explaining why she gave up not only brain, but all of its GitHub projects. It turns out that each was a “personal side project” and she struggled to sustain them all, as she had no “organizational support”. There was “an enormous amount of tedious effort,” she continued, which led her to declare “bankruptcy on GitHub.”
As to why Plummer became interested in brain and wanted to continue, he told me that until Arthur’s project, he had “never seen neural networks grow so simply and understandably.”
How Brain.js has evolved since the fork
It’s been six and a half years since Plummer launched Brain.js, so I asked how different is it from Arthur’s original project?
“In its original incarnation, it was just a feedforward neural network with the ability to output that as a single algorithm – a single neural network trained in essentially a long, long line of code,” he replied. A predictive neural network is a type of neural network where node connections do not form a loop.
Ironically, Plummer seems to have a similar problem to Arthur in terms of maintaining the Brain.js project – a lack of support. He is the only active developer on the project and has to work on it outside of his daily work hours.
“I’m pretty busy with my day job and don’t go there as often as I can,” Plummer said of working on Brain.js. “I’ve had developers come and go over the years. And I reach out to them, you know […] but for the most part, that’s just me.
Plummer spends what little free time he has mostly fixing bugs. But he also started working on “strongly typed, reinforcing neural networks.” Which one is a class of algorithms that aims to automatically improve based on experience.
Many deep learning projects will continue to use TensorFlow or large enterprise platforms like IBM Watson Studio or Google Cloud AI Platform. But if you’re a web developer who wants to try deep learning in the browser or on Node.js, then Brain.js is worth checking out. Especially if you have seeds to manage or stock prices to predict.
Characteristic picture via Shutterstock.