A Quick Guide to The Basics of Machine Learning: Supervised Learning

You must have surely heard of the importance of machine learning. In this article, we will aim to quickly go over the features of what makes machine learning the powerful tool it is.

The first installment of a new series of posts taking you from the basics to the advanced. In this one, we will get an introduction to what is machine learning and overview one major type of machine learning: supervised learning.


Arthur Samuel, the person who had invented the term “machine learning”, defined it as:

Field of study that gives computers the ability to learn without being explicitly programmed

Just as we, particularly when we were young, learn through our senses by observing the results for a given stimulus, machine learning also works in the same way.

For example, if a child picks up food and then drops it, his parents immediately start scolding him. After he does it several times and gets the same unpleasant outcome, he is going to learn from the numerous times he had done the act and will have learned not to repeat this.

Similarly, in machine learning, a computer is given the same task thousands of times. After each task, it becomes more experienced: the next task it works on, it produces a better result than it did for the previous task.

Through feeding the computer a large number of tasks (for commercial companies, it could be in the millions!), the computer becomes proficient at that particular task. That task could be recognizing photos or testing if an email is spam.

In machine learning, these tasks are in the form of input-output pairs, inputs provided to the machine learning model with their corresponding outputs. The input can be thought of as the “task” and the output represents what the final result of completing the task should like. This is called the labelled training data as the input comes ‘labeled’ with the output.

The computer learns from this data provided, called the training data set, in order to be able to perform on unseen data in the future. Each input-output entity is called an example. So if there are 500 inputs and a corresponding 500 outputs, then are 500 examples in the training data (can also be called the training set).

Now by talking about two types of machine learning, you’ll get a better picture of what it does.

Supervised Learning


Imagine a graph full of points. How do you find the equation of the “line of best fit”, a line that goes through most of the points? That’s where supervised learning comes in.

Image result for regression

The “training data” are the “tasks”, as in the previous section, that are given to the computer so that it can generate the function to map the data as above.

Now, when given an unseen, input in the future, we can predict what it’s output will be through this trained function.

You may be thinking that even simple calculators can do this.

But, one training data will not consist of a single x-value. The input may consist of thousands of properties, called features, that may shape the final outcome.

Consider predicting the cost of a house (as taught in Andrew Ng’s excellent online machine learning course). There are hundreds of factors that go into determining the price: from basic things such as number of rooms and square feet to the crime level in the area, the distance of the house from downtown, the average GDP in the area, etc.

A regression machine learning model can combine all of these features into one function that will output a single value: the predicted cost of the house.

This can be applied to other complex situations in order to generate a predicting function that can provide accurate predictions for an example provided to it.


Regression supervised learning generates a function that outputs continuous data: a decimal between 0 and 1 for example. It can be 0.015, 0.245, 0.991, 0.234, and so on. However, in classification supervised learning, a predicting function is generated but it outputs discrete values.

Continuing with our house example, instead of returning the price of the house, it can output what type of house it is from a fixed list of possible types. Is it a “condominium”, a “town home”, a “cottage”, an “apartment”, or a “bungalow”? There are only 4 possible output types the classification system can return, corresponding to the 4 classes of houses.

Image result for data mining classification
Image Source

In the above image, there are only two classes into which the data can fall into. Note how a function is still generated but the function is used a divider between the two classes (left hand is a linear divider while the right hand is a high degree polynomial divider).

Given an input, the classification machine learning model output whether it belongs to class 1 or class 2


That should have given you a general overview of supervised learning. In the next edition, we will talk about what unsupervised learning, an important type of machine learning, is before going into the details and dealing with how to actually implement these algorithms.

One thought on “A Quick Guide to The Basics of Machine Learning: Supervised Learning

  1. Pingback: Unsupervised Learning: The Basics of Machine Learning – Trollgen Tech

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s