Supervised Learning
By: Royina Kj
Tags: Supervised Learning, Machine Learning, Ml Unravelled

Do you remember, as a kid the way your parents would guide you when you were learning to identify dogs and cats? When you got it wrong or identified a dog as a horse, they would tell you that you are wrong and help you learn better. They would repeatedly ask and correct you every time you answered it wrong until you got it right!

Supervised Learning is like teaching a child. You need to monitor what the machine is learning and help it to correct its mistakes! As mentioned in the previous article, supervised learning is the machine learning task of learning a function that maps an input to an output, based on example input-output pairs. It infers a function from labelled training data, consisting of a set of training examples. The learning tasks belonging to this category are classified into regression and classification tasks. It is significant to identify what kind of task is the given problem. In this article, we’ll try to get an intuitive understanding of when to use classification and when to use regression, to solve a supervised learning problem with a few examples.

Example 1:

A small boy goes to a sweet shop and buys 10 sweets for Rs. 100. He goes the next day and buys 3 for Rs.30. The number of sweets he buys and the cost (in rupees) of it in the next five days are tabulated below:

You must have realized by now, that the cost per sweet is Rs.10. It seems like common sense, doesn’t it? The following data can be represented mathematically as y = 10 * x, where y is the cost and x is the number of sweets. So, essentially we’re fitting a line through all the data points we know to be able to estimate the cost for any given number of sweets.

Example 2:

What will be the next number in the following series:

2, 6, 12, 20, ?

The answer is 30. Did you get that right?

The series has a mathematical form of y = x * x +x. When x =1, y = 1 * 1 +1= 2; x = 2, y = 2 * 2 +2 = 6; and so on.

Both the examples have one thing in common, that is, both can be expressed as a mathematical equation and can predict values of y for any given values of x. These type of tasks are referred to as regression tasks.

Regression analysis in machine learning consists of a set of machine learning methods that allow us to predict a continuous outcome variable (y) based on the value of one or multiple predictor variables (x). Briefly, the goal of a regression model is to build a mathematical equation that defines y as a function of the x variables. The most popular real-world application of regression is the housing price prediction.

Example 3:

A school child has recently learned about fruits and vegetables. He wants to help his father segregate the fruits and vegetables they got from the market, to store them in two separate compartments of the refrigerator. Given an apple, he puts it in the fruit compartment and a carrot in the vegetable compartment.

The child is classifying all the items bought into two classes- fruits and vegetables.

Example 4:

When you see a comment on a social media platform, you intuitively classify it as a positive, negative or neutral comment.

The two examples above demonstrate the grouping of items into categories or classes depending on certain factors. In machine learning, Classification refers to a predictive modelling problem where a class label is predicted, for a given example of input data. Examples of classification problems include: Given an email, classify it as spam or non-spam. Given a handwritten character, classify it as one of the known characters!

We will delve deeper into the mathematical concepts and various algorithms used to perform these two kinds of tasks in supervised machine learning in further articles.

Stay Tuned!

Connect • Learn • Grow