Emotion detection with JavaScript neural networks
Machine learning is like highschool sex. Everyone says they do it, nobody really does, and no one knows what it actually is.
- Mike Townsend on Twitter
Machine learning is probably the fastest-growing trend in the tech industry these days.
So, today we’re gonna write a simple program which, with a given string, will tell us if its mood is sad or happy.
Why JavaScript
As a web developer, I find JavaScript to be the most important, fast-growing, and flexible language for web development.
There are so many good Machine Learning frameworks out there (TensorFlow, Cafe2, etc), but coming from the web developer experience, working with JavaScript may result easier and more comfortable.
Of course, there are some limitations: performance, concurrency, JavaScript gotchas (never forget 1 - "1" // 0
, it drives me crazy!), but I think that for the beginning, JS is a really good place to start.
Setting up our project
We’re gonna use Brain.js, the most popular JS-ML framework on GitHub.
I would recommend using Node 8.9.4
with NVM. It fully supports ES6 features (except modules, import
and export
) and async, await
from ES7.