Brain.js Brings Deep Learning to the Browser and Node.js
The lead developer of Brain.js is Robert Plummer, by day a full-stack engineer at iFIT. I reached out to him to find out more about Brain.js, including its beginnings, what it’s currently used for, and plans for the future.
As the name of Plummer’s project suggests, neural networks are computer systems that mimic how a biological brain works. A neural network is made up of connected nodes, loosely modeled on the neurons in a brain. Also like brains, neural networks need to be trained on data that is input 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 a couple of examples from the Brain.js community. “I’ve seen people use it for managing seeds in a farming community,” he said, “and I’ve seen people use it for predicting stock market prices or weather within a location.”
He cautioned that at this stage, data fed into a Brain.js-powered web app requires supervised training. Unsupervised learning and reinforcement learning have not yet made it into the library, he said.
History of Brain.js
Although Plummer is the lead developer of Brain.js and has been working on it since 2016, the library has its roots in a previous project created by Heather Arthur, called brain. Arthur had described her project as “a simple neural network library.” However, she stopped maintaining it around 2014. After some discussion among the brain community, Plummer cloned Arthur’s project in January 2016 — and thus Brain.js was born.
As an aside, Heather Arthur wrote a blog post in 2017 explaining why she abandoned not just brain, but all of her GitHub projects. It turns out that each one was a “personal side project” and she found it difficult to maintain them all, since she had no “organizational support.” There was “a massive amount of tedious effort,” she continued, which led her to declare “bankruptcy on GitHub.”
As for why Plummer became interested in brain and wanted to continue it, he told me that until Arthur’s project, he’d “never seen neural nets developed as simply and understandably.”
How Brain.js Has Evolved Since the Fork
It’s been six and a half years since Plummer started Brain.js, so I asked how different is it now from Arthur’s original project?
“In its original incarnation, it was just a feedforward neural net with the ability to output that as a single algorithm — a single trained neural net within basically one big long, long, line of code,” he replied. A feedforward neural net is a type of neural net 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’s the only active developer on the project and has to work on it outside the hours he spends on his day job.
“I’m quite busy with my day job and I don’t get to it as frequently as possible,” Plummer said, regarding work 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, it’s just me.”
Plummer spends what little spare time he has mostly fixing bugs. But he’s also started working on “reinforcement neural nets, strongly typed,” which is a class of algorithms that aims to improve automatically based on experience.
A lot of deep learning projects will continue to use the likes of TensorFlow, or big company platforms like IBM Watson Studio or Google Cloud AI Platform. But if you’re a web developer wanting to try out deep learning inside 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.