# Machine Learning Paradigms with Example

Souvik Majumder 25 Jul, 2022 • 6 min read

This article was published as a part of the Data Science Blogathon.

## Introduction

Let’s have a simple overview of what Machine Learning is.

Machine Learning is the method of teaching computer programs to do a specific task accurately (essentially a prediction) by training a predictive model using various statistical algorithms leveraging data.

Source: https://www.spiria.com/site/assets/files/6009/ai_banner.-large.jpg

For example, we have the following dataset:

Source: https://communities.sas.com/t5/image/serverpage/image-id/36435i6BBB5C52826D31EE/image-size/medium?v=v2&px=400

Suppose ‘Value_1’ and ‘Value_2’ are input variables and ‘Value_1_times_2’ is the output variable. Although we can infer manually from the data that the output result is the product of the input values, the data do not explicitly state that the mathematical formula of multiplication is being used in this situation.

If we feed this data into a machine learning algorithm to build a predictive model, it will automatically detect the relationship between the input and the output variables and will be able to predict the output values for new unseen (future data) input values. The accuracy of this prediction depends on many factors that are out of the scope of this article.

Now, let’s focus on machine learning paradigms. A learning paradigm describes a particular pattern in which someone or something learns. The learning paradigm to be applied is determined by the problem to solve and the dataset used in a particular scenario.

## How many Machine Learning Paradigms? And, what are they?

Machine Learning is generally categorized into three primary paradigms. They are:

• Supervised Learning
• Unsupervised Learning
• Reinforcement Learning

Machine Learning Bubble Chart

Source: https://miro.medium.com/max/1400/0*_cgWPP25djXBauNZ.png

## High-Level Understanding and Insight into the different Machine Learning Paradigms

#### 1. Supervised Learning

High-Level Understanding in respect of real-life example:

Let’s understand the concept of the Learning Paradigms with the life of a baby boy named Lucas.

Lucas cannot yet identify or differentiate the different animals he sees in his neighborhood. So, his mother takes on the responsibility of teaching him about the various animals. She shows him an animal mentioning that it is a dog. She shows him another animal and tells him that it is a cat. This keeps repeating, and Lucas’ brain develops certain neural connections that help him differentiate and identify the different animals by understanding the relationship between the characteristics of specific animals and the keywords, viz. dog, cat, etc.

Therefore, Lucas learned to identify and classify the animals under supervision, essentially by a teacher.

Source: https://miro.medium.com/max/3840/1*oB3S5yHHhvougJkPXuc8og.gif

The above is an example of a classification problem as a categorical value is being predicted.

Detailed Insight into the learning paradigm:

• In supervised learning, the computer learns from a labeled dataset, i.e., a set of input-output pairs.
• Supervised learning aims to train a predictive model by feeding these input-output pairs of data into statistical algorithms.
• The trained model learns the relationship between the input and output and becomes capable of predicting output values for new unseen or future input values.
• The input or the independent variable(s) is/are called Feature(s), and the output or the dependent variable(s) is/are called Target Variable(s) or Label(s).

Let’s consider an example of the application of supervised learning. Following is a demo dataset of animal characteristics:

Let’s set the columns ‘Age’ and ‘Sex’ as Features and ‘Weight’ as the Target Variable. Therefore, after we feed this data into a statistical algorithm and build a predictive model, it will be able to predict ‘Weight’ for any values of ‘Age’ and ‘Sex’ that are not present in the dataset used to train the model.

The above example is a regression problem as our target variable is a real/continuous value.

#### 2. Unsupervised Learning

High-Level Understanding in respect of real-life example:

Lucas has grown up a bit. Along his way to school, he sees a lot of different breeds of dogs possessing different characteristics.

Lucas does NOT have a teacher by his side now to tell him which dog is of what breed. But, he still tries to differentiate them and after some time, becomes capable of doing so even if he does not know the names of the specific breeds yet.

Therefore, Lucas learned to differentiate the dog breeds with NO supervision, essentially without a teacher.

Source: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQYs7jv-KipkLkKSxR-gCtFIM6z1uExbE_wQg&usqp=CAU

Detailed Insight into the learning paradigm:

• In unsupervised learning, the computer learns from an unlabeled dataset, i.e., there are NO input-output pairs, the data is just a set of observations or examples.
• The unlabeled data is fed into an unsupervised machine learning algorithm to cluster or group the observations by analyzing the hidden patterns without human intervention.

For example, if we feed a dataset similar to the one in the supervised learning section (without considering Features and Target Variables) into an algorithm to build an unsupervised machine learning model, it clusters the observations in the following way:

The above is an example of a clustering problem/application.

#### 3. Reinforcement Learning

High-Level Understanding in respect of real-life example:

Lucas has developed an interest in chess. So, his parents let him join a chess academy. The teacher starts with the basics, and then decides to arrange chess matches among the students regularly.

The Rules are:

• When a student wins a match – the student is rewarded with two chocolates.
• When a student loses a match – the student is punished by taking away one chocolate.

The teacher believes that the students learn and improve their chess skills with this method.

This is the same way computers (AI) are taught to play chess using the reward and punishment mechanism.

Detailed Insight into the learning paradigm:

• Reinforcement Learning is a lot different from the other two paradigms discussed above.
• Unlike the other learning paradigms, a complete dataset with fixed values is NOT provided during training the model.
• Rather, it is a process of continuous learning and improvement.
• Leveraging the strategies of trial-and-error and reward-and-punishment, autonomous agents are taught a given task where they start undertaking certain random actions as a trial for which it is either rewarded if correct or punished if wrong.
• Eventually, the autonomous agents learn and improve from the consequences of their actions received from an external system called the environment.

## Conclusion

This article discusses the various machine learning paradigms in plain language and from a technical standpoint, making it easier to comprehend the subject matter, put it into practice, and respond confidently to any question relating to the topic in interviews.

• The three different machine learning paradigms help to solve different problem categories.
• Supervised Learning is all about learning from a dataset of labeled examples and finding the correct label for new input examples in the future. It is similar to learning with a teacher.
• Unsupervised Learning is about finding patterns and underlying relationships from unlabeled data. It is similar to learning without a teacher.
• Reinforcement Learning is a situation where an autonomous agent is placed in an unfamiliar environment that will find the correct set of actions by using trial-and-error along with reward-and-punishment mechanisms.

Souvik Majumder 25 Jul 2022