Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 57

Types of Machine Learning

Recommended resources

Hello! Welcome to the first lesson in our "Foundations of Machine Learning" module.

In the previous module, you mastered how to design, query, and interact with databases, culminating in fetching data directly into a Python environment using Pandas. That skill is the essential first step in any data science workflow: getting the data. Now, we move on to the exciting part: what can we do with this data to build intelligent systems?

This lesson addresses that very question by introducing you to the fundamental paradigms of machine learning. Your learning outcome is to distinguish between supervised, unsupervised, and reinforcement learning. Understanding these three categories is the most important first step in your machine learning journey, as every algorithm and application you'll encounter will fall into one of these types.

What is Machine Learning?

Before we dive into the different types, let's start with a broad overview. At its core, machine learning is a subset of artificial intelligence (AI) that gives computers the ability to learn from data and make decisions or predictions, without being explicitly programmed for every single scenario.

You interact with machine learning models every day. Let's start by watching a short video that highlights some of these common examples.

Machine Learning 01 | Introduction To Machine Learning | DA | GATE Crash Course

This video from GeeksforGeeks GATE English, a channel focused on your exam goal, provides some excellent real-world examples of machine learning in action.

Please watch the following two clips: Introduction with Examples (01:09 - 06:02): Pay attention to the examples mentioned, like predictive text, YouTube recommendations, and win probabilities in sports. Think about how these systems might be 'learning'. Definition of Machine Learning (14:41 - 16:10): This part provides a formal definition, emphasizing the key phrase 'learn from data without explicit programming'.

As you saw, the key idea is moving away from hard-coded if-else rules and instead allowing a model to identify patterns from data. The way a model learns these patterns is what defines the three major types of machine learning.


The Three Paradigms of Machine Learning

At a high level, we can categorize most machine learning tasks into three main types. The fundamental difference between them lies in the nature of the data they are given and the feedback they receive during the learning process.

Visual Distinction of Machine Learning Types
This simple image provides a great mental model for the three paradigms. **Supervised learning** is like having a teacher provide examples. **Unsupervised learning** is like studying on your own to find patterns. **Reinforcement learning** is like a robot learning through trial and error in its environment.

Let's explore each of these in more detail.


1. Supervised Learning: Learning with a Teacher

In supervised learning, the algorithm learns from a dataset that is labeled. This means every piece of data is tagged with a correct answer or outcome. The model's job is to learn the mapping function from the input data to the output label.

  • Analogy: Imagine a student (the model) learning with a teacher. The teacher provides a set of problems (input data) along with their corresponding solutions (labels). The student studies these pairs to learn the general rules, so they can later solve new problems on their own.

Supervised vs Unsupervised vs Reinforcement Learning | Data Science Certification Training | Edureka

The Edureka! channel offers a great analogy for supervised learning. Let's watch their explanation.

Watch the clip from 02:20 to 02:57 which explains supervised learning using the teacher-student analogy.

The GeeksforGeeks video you watched earlier also gives a concrete example of this with labeled shapes.

Supervised vs. Unsupervised Learning Illustration
This diagram clearly shows the core of supervised learning. The input data is labeled (we know which image is a pear, apple, etc.), and the model learns to produce the correct label for a new, unseen input.

Supervised learning problems are typically divided into two categories:

  • Classification: The output label is a category. Examples include spam detection ('spam' or 'not spam'), image recognition ('cat', 'dog', 'car'), and medical diagnosis ('malignant' or 'benign').
  • Regression: The output label is a continuous numerical value. Examples include predicting a house price, forecasting stock market values, or estimating a student's final grade.

2. Unsupervised Learning: Finding Your Own Patterns

In unsupervised learning, the algorithm is given unlabeled data. There are no correct answers or predefined outputs. The model must analyze the data and discover hidden structures, patterns, or groupings on its own.

  • Analogy: Imagine being given a box of assorted fruits you've never seen before. Without any instructions, you might start grouping them based on their color, size, shape, and texture. You are finding the structure inherent in the data without a "teacher" telling you what the fruit is called.

Supervised vs Unsupervised vs Reinforcement Learning | Data Science Certification Training | Edureka

Let's continue with the Edureka! analogies to understand unsupervised learning.

Watch the clip from 02:57 to 03:33 which explains unsupervised learning as learning without supervision, like an adult figuring things out on their own.

The most common types of unsupervised learning problems are:

  • Clustering: Grouping similar data points together. This is used for customer segmentation (finding groups of similar customers), social network analysis, and grouping similar news articles.
  • Association: Discovering rules that describe large portions of your data, like "customers who buy bread also tend to buy milk." This is the basis of market basket analysis and recommendation engines.

3. Reinforcement Learning: Learning from Experience

Reinforcement learning (RL) is different from the other two. It's about training an agent to make a sequence of decisions in an environment to maximize a cumulative reward. There is no predefined dataset. The agent learns through trial and error.

  • Core Components:

    • Agent: The learner or decision-maker (e.g., a self-driving car's control system).
    • Environment: The world the agent interacts with (e.g., the road, other cars, pedestrians).
    • Action: A move the agent makes (e.g., accelerate, turn left).
    • Reward/Penalty: Feedback from the environment. A positive reward for a good action (e.g., reaching the destination safely) and a penalty for a bad one (e.g., a collision).
  • Analogy: Teaching a dog a new trick. You don't give it a dataset of "good" and "bad" actions. Instead, you give it a treat (reward) when it does something right (like sitting on command) and withhold the treat or give a negative signal (penalty) when it does something wrong. Over time, the dog learns a policy of which actions lead to the most treats.

Supervised vs Unsupervised vs Reinforcement Learning | Data Science Certification Training | Edureka

The 'stuck on an island' analogy in this next clip is a fantastic way to understand the core idea of reinforcement learning.

Watch from 03:33 to 04:30. Notice how the learning happens through interaction, experience, and feedback (discovering what's safe to eat).

RL is commonly used in robotics, game playing (like AlphaGo), and optimizing complex systems like data center cooling.


Direct Comparison: Putting It All Together

Now that you have an idea of each type, let's look at a direct comparison. The best way to distinguish them is to compare them across several key criteria.

Supervised vs Unsupervised vs Reinforcement Learning

This article from GeeksforGeeks provides a very clear and concise comparison table that is perfect for study and review, especially for an exam like GATE.

Focus on the 'Comparison Table'. This table brilliantly summarizes the key differences in terms of definition, data type, problems solved, goal, and applications. This is the core of what you need to know for this lesson.

To reinforce the main distinctions:

Criteria Supervised Learning Unsupervised Learning Reinforcement Learning
Data Labeled Data Unlabeled Data No predefined data; agent collects data through interaction
Goal Predict outcomes accurately Discover hidden patterns Learn a series of actions to maximize rewards
Feedback Direct feedback (the correct labels) No direct feedback Indirect feedback (rewards/penalties)
Test your understanding!

For each of the following scenarios, decide which type of machine learning (Supervised, Unsupervised, or Reinforcement) would be most appropriate.

  1. You have a large dataset of emails, and you want to build a system that automatically groups them into categories like "Primary," "Social," and "Promotions" without you defining the categories beforehand.
  2. You are given historical data of house sales, including features like size, number of bedrooms, and location, along with the final sale price. You want to build a model to predict the price of a new house.
  3. You want to train a robot to navigate a maze and find the exit. The robot can only see the walls immediately around it and receives a positive signal when it reaches the exit.
  4. A hospital has a database of patient records with medical images, each labeled by a doctor as either "cancerous" or "non-cancerous." You want to develop a system to assist doctors by classifying new, unseen images.
Show answer
  1. Unsupervised Learning (Clustering). The key is that you want the system to discover the groups on its own from unlabeled data.
  2. Supervised Learning (Regression). You have labeled data (house features are the input, sale price is the output label), and you are predicting a continuous numerical value.
  3. Reinforcement Learning. This is a classic RL problem. An agent (the robot) learns to make a sequence of decisions (actions) in an environment (the maze) to maximize a reward (reaching the exit).
  4. Supervised Learning (Classification). You have labeled data (images with their correct diagnosis), and you are predicting a discrete category ('cancerous' or 'non-cancerous').

Conclusion

Congratulations on completing your first lesson in machine learning! You now have a solid conceptual framework for understanding the entire field.

Key Takeaways:

  • Supervised Learning uses labeled data to predict an outcome. It's like learning with a teacher. It includes classification (for categories) and regression (for numbers).
  • Unsupervised Learning uses unlabeled data to discover hidden patterns or structures. It's like learning on your own. It includes clustering (for grouping) and association (for finding rules).
  • Reinforcement Learning involves an agent learning to make a sequence of decisions in an environment through trial and error, guided by rewards and penalties.

This fundamental distinction will guide you as we explore specific algorithms in future lessons. You will always start by asking: "What kind of problem is this, and what kind of data do I have?" The answer will point you to the right paradigm.

Preview of the Next Lesson:
Now that you understand the different learning types, we need to get practical. Our next lesson will focus on a critical first step in any supervised learning project: Splitting a dataset into training, validation, and test sets for model evaluation. You'll learn why we can't just use all our data for training and how to properly prepare it to build a model that performs well on new, unseen data.