Machine Learning for Everyone

Deepak Mishra
Sep 4, 2018 · 6 min read
What does that mean ?

The title begs the question “What does that mean ?”. Okay, the term Machine Learning might be alien to you but how about Artificial Intelligence, I bet you have heard of that. For starters, let’s just say that machine learning is a subset of AI and it has enabled a lot of progress in the field of AI. A quick google search with the keywords “Machine Learning for” yields the following suggestions:-

machine learning for …

I will cut to the chase. This is a series of posts that covers one of the most fundamental algorithms of Machine Learning i.e Decision Trees. Now before you run away thinking this was a click-bait, let me tell you that this post will not involve any mathematics at all!

Whatever, why should I read it ?

Artificial Intelligence has begun to change the way humans live their daily lives. Every bit of our online presence is attached to an AI element. Smartphones, smartwatches, smart home devices, voice assistants (Google assistant, Siri, Cortana, etc) have AI written all over them.

Voice assistants like Alexa can understand sentences as you speak and respond with smart answers and keeps adapting to your needs. Now if you aren’t a tad bit curious about how they work, then honestly you don’t have to read along. However if you are, this is a perfect place to start.

Artificial Intelligence is a broader goal and Machine Learning is a means to that end. It is the design and study of methods that use data to learn behaviors and make decision. Decision tree is a fundamental ML algorithm.

This post tries to make you wonder that you have been using ML concepts in your daily life, although subconsciously.

How to read this series

This series consists of 3 posts. Each post gets more involving for the reader either mathematically or intuitively or both.

  1. First post assumes that you are an 8 year old who wants to learn Machine Learning (Ambitious Kid, eh!)
  2. Second post assumes that this kid has grown up a bit and is equipped with some mathematics to pickup the core concepts of Decision trees.
  3. Third post goes deeper into Machine Learning by describing Random Forests.
Enough said, let’s get to it.

The Diary of Jane

Jane is just another smart 8 year old who likes ‘SpongeBob SquarePants’ and more importantly chocolates. She goes to her mother ‘Mary’ everyday asking for chocolates, sometimes asking for more than one. Her mother gives her chocolates sometimes while sometimes she doesn’t [ No one should be ever denied chocolates ☹️ ].

Jane is a curious girl. She want to know in advance if her mother is going to honor her request for chocolates even before asking her. Not knowing what to do, she goes to her father ‘Tom’ and describes her situation. Tom gets excited by the curiosity in his baby girl and thinks for a while. After sometime, he calls Jane and presents her with a diary. He asks Jane to note down her observations about when she asks her mother for chocolates.

Tom says “Jane, fill this diary with your observations for 10 days and then we will discuss further”

Let’s do it!

The Eleventh Day

On the eleventh day Jane comes to Tom running with her little diary. She sits on the bed besides her father and says

I have done it Daddy

“Great”, Tom replies and proceeds to open up the diary.

Lets see what you have got here

  1. I asked mom for a chocolate in the morning and she said No.
  2. It was evening when I got a chocolate. She seemed in a good mood.
  3. I asked for a chocolate when aunt May came over. Got it. Piece of cake.
  4. Even before I asked for a chocolate today, she said No. She was mean :(
  5. I had tooth pain so mom took me to a Dentist. No chocolate today.
  6. I didn’t even ask for a chocolate due to the tooth pain. No chocolate.
  7. She wished that she could give me chocolate. But my tooth would hurt so no chocolate. She was cheerful though.
  8. Uncle David came over today. I got a chocolate today despite the tooth pain. Puppy face did the trick I guess.
  9. I asked for a chocolate in the morning again. Why is mom so strict. Not cool.
  10. I saw mom sing today after so many days. I thought it would be a good idea to ask for a chocolate. Got it, yay.

“Great job with the diary Jane”, said Tom.

Tom goes through the diary and makes a small table for Jane to look at the data in a clearer way.

Tom: I have read your diary and made a simple table out of your observations. Do you feel that I have made a correct table.

Jane: Yes dad. Looks good to me.

Tom: Now lets try to figure out if we can predict the possibility of getting a chocolate based on your your observations.

Jane: Okay dad.

Tom: So tell me, when do you think that your mother is highly likely to give you a candy.

Jane: That’s pretty simple dad. Whenever a guest comes over, mom gives me a chocolate upon request.

Tom: Excellent. You have got that observation right. Now lets make a new table which has those observations removed.

Tom: Now tell me, when is she likely to not give you a chocolate ?

Jane: I am not sure dad, but I think whenever I have a tooth ache she doesn’t give me chocolates.

Tom: You are right Jane, although there is one case where she gave you a chocolate even though you had a tooth ache, but she is likely to not give you any chocolates in such cases.

Tom: Now lets look at an updated table. I am going to remove all the observations when you had a tooth pain and you didn’t get a chocolate.

Jane: This looks right. Oh wait, I got it. Now I have to see the effect of mom’s mood on her giving me a chocolate.

Tom: Excellent, keep going.

Jane: So it looks like whenever mom is in a good mood, she is likely to give me a chocolate.

Tom: Bravo Jane, Bravo. Now if you can summarize what you learnt then I will give you a chocolate.

Jane: I am likely to get a chocolate when a guest visits us. However, if there is no guest, then it depends on two things. First, if I have a tooth pain, I am most likely not getting any chocolates. Second, if I have a happy tooth, then it depends on mom’s mood to give me a chocolate. Isn’t that right daddy.

Tom: Here, take your chocolate!


So Jane grew up eating chocolates because she figured out when to ask her mother for chocolates with a good success rate even since she was only 8 years old.

But where is the Decision Tree ?

Okay okay, let’s use Jane’s summary to make a decision tree.

Summary

If you have read along, you would have noticed that decision trees are not so bad. They are pretty simple to build given that we have some data.

I like to think that a lot of human decision are governed by such decision trees or rules of thumb that we build over the years with experiences of all sorts. For example, we have a rule of thumb to not put our hands in fire as we will pretty much get hurt.

So you see, machine learning is just playing at a larger scale. It is making sense out of larger data, with more variables and solving problems much complex than “Will Jane get a chocolate”

Are you still a non believer of Machine Learning ?

Deepak Mishra

Written by

I like to explore anything that interests me. Here is the fun part, I never know what might interest me.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade