Machine Learning concepts for everybody

The other day, I was talking to a friend and she asked me

“Krishna, what is machine learning? I keep hearing about it everywhere”

I spent around 5-10 minutes explaining to her, post which we moved to more interesting topics!

This gave me the idea that if I blog in a lay man’s language, it may benefit more people

No no no, don’t be alarmed, I’ll do my best to keep it simple, even to a fault, so that you can understand and brag to your friends

So before we jump into the nitty-gritty’s, let us look at some real life examples where we are exposed to machine learning

Example 1 : e-mail

Back in the 90’s when internet became accessible in India, a friend of mine took me to a browsing centre and introduced me to the world of internet

To those of you, who have no idea on what a browsing centre is; it was a place where you go to access internet! There would be 5-20 computers and you had to wait for one to be free & pay by the hour

I was fascinated at how easily one could contact to someone in the other part of the world through e-mail. Pretty soon, I had made couple of e-mail friends and I used to frequent the browsing centre

Every week, I used to get a few emails from my e-friends and there used to be couple of marketing mails. With time the ratio increased, tipping onto the latter. Very soon, e-mail started having another folder next to Inbox which was called the Junk folder and I could label a mail as a Junk mail

The next time a similar mail came, it automatically moved to the junk folder. It was not always reliable and I would have to check the junk folder as well to ensure I didn’t miss any of my friends replies

Now speeding up to 2020, things haven’t changed much. I still occasionally receive a mail from someone who’s rich uncle had died leaving a million dollar to be claimed and if I gave my bank details for the transfer, I would receive 60% of the loot. Yeah, that’s a spam mail delivered in my Inbox

The difference between the 90’s & 2020 is that the classification accuracy has improved. However coming back to our discussion, who’s moving the relevant e-mails to the inbox and the junk to the spam folder?

Is it some individual who is scanning through each and every mail & moving them? Surely no!

This is machine learning under play! We will see how, in some time

Example 2 : Banking

A few years back, I happened to use my Indian credit card in an international airport. Within 5 minutes I got a call to ascertain if the transaction was fraudulent

I was quite impressed at the speed of response. Was anyone manually monitoring each and every transaction and labelling them as fraud?

Absolutely not. Again it is machine learning at play. We will see how, a little later

Example 3 : Streaming platforms

If you watch any of the streaming services like YouTube, Netflix, Amazon Prime, you see recommendations based on your viewing history. Is someone manually tagging the videos!

Impossible. Machine learning, at your service!

Now that we have seen a few examples of machine learning in real life, lets understand “one” definition of machine learning

What is Machine Learning

Machine Learning is a subfield of Artificial Intelligence, which enables machines to learn from past data without someone having to explicitly program

If you have come with me this far, you now know enough, to identify a machine learning application when you see one

Types of Machine Learning

Let us now bite into the meat or if you are a vegetarian, bite into the tofu of Machine Learning

We can generally classify Machine Learning into these three types

  • Supervised Learning
  • Unsupervised Learning
  • Reinforcement Learning

Supervised Learning

Let us go back to our first example of spam e-mails. We agreed that a super-human isn’t classifying each of our mails, so what’s happening?

When a spam mail first lands in your inbox and you move it to junk i.e. label it as spam, this information is recorded. The information of the non-spam mail in your inbox is also recorded. Think of it as being recorded in a spreadsheet, where each row is reserved for one instance of a mail, of all the mails that goes around the world

Each column in the spreadsheet is reserved for a unique feature. A feature can be attributed to some characteristic of the email, for example each word (eg. offers, promotion) in the email could be split into columns, the sender’s email id as another column, etc

When more emails are added to this ‘spreadsheet’, the columns also increases with whichever unique feature that exists in them. Each of these emails are also marked as a “spam” or “non spam” i.e. 1 or 0

Now this matrix also has each cell filled with 0 or 1. If the feature exists in that e-mail, that cell is marked as 1 and if not as 0

So now we have millions of emails marked as spam and not a spam, with the columns as 1 or 0. Now all the program needs to do is study this pattern and for a new email, predict if this is a spam or a non spam

Representation of supervised learning

Therefore in supervised learning, the machine learning program needs a set of labelled data to train itself, so as to predict a future instant

Whats critical to note here is, a programmer isn’t writing specific code to differentiate every condition of a spam or a non spam. The machine is learning by itself through its algorithm by studying the data

There are two subcategories of Supervised learning – Classification and Regression

  • Classification is like in the email example which we discussed, where the goal is to classify “this or that”
  • Regression is where the goal is to arrive at a specific number, for example what would be tomorrow’s stock price

Unsupervised Learning

The second example which I mentioned, where the bank had called me the moment I made a transaction outside India, is an example of unsupervised machine learning

Here there was no prior labelling done for the machine learning algorithm, yet how did the algorithm identify this particular transaction?

The algorithm looked at patterns from the data and found this transaction to be an outlier, therefore it flagged this off as a suspicious transaction. Specifically, the algorithm looked at anomaly detection

Representation of unsupervised learning

One of the main difference between supervised and unsupervised learning is that, in unsupervised learning, there is no prior labelled data and the machine tries to find patterns from the input data

The third example that we saw also falls under unsupervised learning. When we watched certain videos, the algorithm formed patters of association and recommended us new videos whose features closely matched our preferences

Reinforcement Learning

Wouldn’t it be awesome or scary, if a drone could fly all by itself from place A to place B and land without any manual intervention?

That’s reinforcement learning for you!

You can visualise reinforcement learning as some kind of a mathematical equation where every time the drone takes off, you reward the program 5 points and every time it fails, you punish it by -10 points. You also set the overall goal of the program, to earn the maximum award

So the algorithm keeps modifying the weights of the equation and keeps iterating till it identifies how to maximise the overall reward; and in this case, the implication of this behaviour would be for the drone to take off and land without crashing

In Reinforcement learning, the algorithm uses past feedback and explores new tactics to maximise the final payoff

This is akin to how we modify the behaviour of kids through carrot and stick method

Final words

If you have come this far, you really need an applause! You can now officially brag that you conceptually understand machine learning!

If you want to take your vocabulary to the next notch, then read up on Confusion matrix, Train data, Test data, Neural Networks, Deep Learning, NLP and Computer Vision

These will give you further breadth and depth on machine learning concepts

If this interested you and if you would want me to talk more about these topics, then do comment. If you think this article could help someone, then do share it

Read more of my blogs here