Machine learning in JavaScript and 2017

Simple animation with d3.js

After leaving engineering, I pursued psychology for some time. My interest varied from Hypnosis, Close up magic, cognitive illusions to study of expressions. My universe revolves around this 11 pound jelly that we call brain. The subject becomes even more fascinating when it’s described by people like V S Ramachandran and Oliver Sacks. When I read Tale Tell brain by Dr. Ramachandran I felt mesmerized by subject and his approach of exploring brain. He studies patients who have weird brain diseases what I would call a brain with a quirky way. It’s very clear from his approach that every time brain fails to do something in normal fashion,we have a window of opportunity to understand how it works. This is of course one of many ways. I like Feynman approach. Richard Feynman said

It’s the way I study — to understand something by trying to work it out or, in other words, to understand something by creating it. Not creating it one hundred percent, of course; but taking a hint as to which direction to go but not remembering the details. These you work out for yourself.

And that’s how my story begins. I had heard that computer science has a discipline called Neural network. I read about it in Paul Ekman’s book “What the face reveals”. I didn’t know what it was but they said you could teach machines to recognize expressions of emotions. That is pretty cool. I wanted to learn this new discipline. I chose it as my way of exploring brain, by recreating it. That’s why and how I got into programming. Now, it’s been two years and it was one hell of a ride. I had to learn a lot about programming before I could even start with machine learning and neural nets. I took up a job as web developer and finally I’m ready!! Now I have the tools I need to create the brain. It’s a big challenge that keeps life interesting. First step is to learn algorithms that exist. Algorithms to classify and algorithms to predict. Next step would be to try to mimic the brain functions.

Last month I started my journey into machine learning. It’s mostly algorithms algorithms algorithms. You definitely need a lot of practice. So I decided to write the same algorithm in three languages. First I write it in Python then JavaScript then PHP. By the time I come back to Python, I feel pretty confident. A lot of people do not try machine learning because most of the resources out there are in Python or some other language. So I decided to write a series in JavaScript for web developers. After all, Algorithms are language agnostic. Once you understand the algorithm, you can implement it in any language. Besides you can create really beautiful visualizations very quickly using JavaScript. Every Monday, I’m going to publish one algorithm with some visualization of the concept. I use d3.js to create visualizations and some times just canvas API. If you know d3.js it even better. Who doesn’t like a visual treat after all! Following is the list of algorithms I would love to cover.

  • k nearest neighbor
  • classification with decision trees
  • classification using probability : Naive bayes
  • Logistic regression
  • support vector machines
  • Neural Networks

Some algorithms solve classification problems like classifying a fruit as apple orange or banana and some of them solve problems of predicting future like predicting stock market prices. We are going to create a canvas applications like, user draws a number and the program will recognize the handwritten digit. It’s a great adventure ahead. Would love your company.