My little introduction to Supervised Learning

Posted on Posted in Artificial Intelligence

Hey my friends, this is the article 88 / 1000! For those who don’t know me, my name is Selim Chehimi and I’m an engineering student. I’ve been programming for 7 years now so you can tell that I really enjoy that. Those 7 years of programming lead me to Artificial Intelligence. My dream is to build an AI Startup so that’s the reason why I’m sharing this article with you. I hope that you’ll enjoy reading it as much as I’ve enjoyed writing it.

What’s up guys, I hope that you’re doing well! If you have read my last Article, then you know that I’m following an online course to learn Machine Learning. I’ve started the first lecture on Machine Learning presented by Geoffrey Hinton on Coursera. However, I’ve found that the AI Researcher Andrew Ng had also made an online lesson on Coursera. I have a lot of respect for this man and I enjoy listening to him more than Hinton so I’m going to follow his course instead. In the last Article, I’ve somehow made a brief presentation of Machine Learning. On this Article, I will present you one of the subfields of Machine Learning: Supervised Learning.

Supervised Learning

Supervised learning is one of the most common types of machine learning problems. Let’s look at a basic supervised learning problem. Here is a simple dataset, the housing price in function of the size in feet².

Size in feet² Housing price prediction
400 100 K $
600 140 K $
600 200 K $
700 220 K $
1000 300 K $
1250 280 K $
1400 310 K $
1600 300 K $
1700 340 K $
2000 300 K $
2250 290 K $

If we plot these data, we got that:

We have the price of the house on the vertical axis and the size of the house on the horizontal axis. To make a prediction for a 750 feet² house, your machine learning algorithm might put a straight line through the data like this:

Here, the price of a 750 feet² house would be 150K $.

There are a bunch of different possibilities. For example, your machine learning algorithm might have gotten you a better curve (in blue):

In this case, the house is now at 200K $.

This example is a supervised learning problem because we already have the right output (price) for every corresponding input (size). Precisely, this type of problem is called a regression problem because we are making a prediction.

Let’s take another example with breast cancer. The goal here is to predict whether a cancer is malignant or benign given the tumor size. Here is our data set:

As you can see, for each input (tumor size), we have the corresponding output (malignant or not). Consequently, this type of problem is a supervised learning problem.

However, this time, we have a classification problem (not a regression problem) because we are trying to classify whether a cancer is malignant or not.

Let’s look at another example of classification problem.

As you can see, the input is always the tumor size but now, the output is the age. The crosses represent malignant cancer and the circles represent the benign ones. From there, let’s say that one of your friends has a tumor and he wants to know whether the tumor is malignant or not. First, we put his data on our graph:

Then, a machine learning algorithm would try to separate the malignant tumors from the benign ones. The algorithm would maybe classify the dataset like that:

Consequently, you friend tumor has more chance to be benign because it’s on the benign side.

By the way, in this case, we have two features (the tumor size and the age) but in most advanced machine learning problems, we will have more (an infinity!).

That’s the end of my little introduction to supervised learning. I want to specify that this intro is exclusively based on Andrew Ng’s lectures. I’m not creating anything, I’m just writing Articles of his lectures along the way. It helps me to understand them better and if it can also help some of you, I will be very humbled.

Thanks so much for reading, that’s the end of Article 88. Please, share it and don’t forget to follow me on social media. You can also subscribe to my newsletter below to never miss any article. Don’t hesitate to tell me what you think of this Article in the comments and stay tuned for another one tomorrow!


Signup now and receive a FREE eBook about the basics of Artificial Intelligence!
We hate spam. Your email address will not be sold or shared with anyone else.

Leave a Reply

Your email address will not be published. Required fields are marked *