AI Fundamentals • Lesson 10

Types of Machine Learning

Machine Learning is not one single method. There are different approaches for teaching machines how to learn from data and experience.

In this lesson, we'll learn the three major types of Machine Learning: Supervised Learning, Unsupervised Learning, and Reinforcement Learning.

👨‍🏫

Supervised Learning

Learns from examples that already have known answers.

🔍

Unsupervised Learning

Finds patterns or groups in data without known answers.

🎮

Reinforcement Learning

Learns through actions, feedback, rewards, and penalties.

By the End of This Lesson

  • Understand what Supervised Learning means.
  • Understand what Unsupervised Learning means.
  • Understand how Reinforcement Learning works.
  • Compare the three main learning approaches.
  • Recognize simple real-world examples of each type.

Supervised Learning

Supervised Learning is a type of Machine Learning where the system learns from examples that already have known answers.

In other words, the training data contains both the input and the expected output.

The model learns the relationship between the input and output and then uses that learned relationship to make predictions for new data.

📚 Learning With Labeled Examples

The data used in Supervised Learning is commonly called labeled data.

For example, imagine we want to build a system that identifies whether an email is spam.

We can provide examples like these:

Email Label
"You won a free prize!" 🚨 Spam
"Your order has shipped." ✅ Not Spam
"Claim your reward now." 🚨 Spam

The model can study these examples and learn patterns associated with spam and non-spam messages.

🤖 How Supervised Learning Works


📚 Labeled Training Data
        │
        ▼
🤖 Machine Learning
        │
        ▼
🔍 Learn Relationship
        │
        ▼
🧠 Trained Model
        │
        ▼
📩 New Email
        │
        ▼
📊 Prediction
        │
        ▼
🚨 Spam / ✅ Not Spam

🎯 What Can Supervised Learning Predict?

Supervised Learning is commonly used for two broad kinds of problems: classification and regression.

Classification means predicting a category.

For example:


📧 Email
   ↓
🤖 Model
   ↓
🚨 Spam
   OR
✅ Not Spam

Regression means predicting a numerical value.

For example, a model could predict the price of a house based on information such as its size, location, and number of bedrooms.


🏠 House Information
        ↓
🤖 Model
        ↓
💰 Predicted Price

Simple Definition

Supervised Learning is a Machine Learning approach where a model learns from labeled examples containing known inputs and outputs.

Next, we'll use a simple real-world example to make Supervised Learning even easier to understand.

A Simple Supervised Learning Example

Let's use a simple example to understand how Supervised Learning works in practice.

Imagine that we want to build a system that predicts whether a student will pass an exam based on the number of hours they studied.

📚 Training Data

First, we give the system examples where the correct result is already known.

Study Hours Known Result
1 hour ❌ Failed
2 hours ❌ Failed
4 hours ✅ Passed
6 hours ✅ Passed
8 hours ✅ Passed

Notice that every training example contains two things:

📥 Input: Number of study hours

📤 Known Output: Passed or Failed

🤖 Learning From the Examples


📚 Labeled Examples
        │
        ▼
🤖 Supervised Learning
        │
        ▼
🔍 Learn Relationship
        │
        ▼
🧠 Trained Model

The model examines the examples and learns a relationship between study time and exam results.

It may learn that students who study more hours tend to have a higher probability of passing.

🎯 Predicting a New Student

Now suppose a new student studies for 5 hours. We don't yet know whether that student will pass.


📚 New Student
       │
       ▼
⏱️ 5 Hours
       │
       ▼
🧠 Trained Model
       │
       ▼
📊 Prediction
       │
       ▼
✅ Higher Probability of Passing

The important point is that the model is making a prediction based on patterns learned from previous labeled examples.

⚠️ Prediction Is Not a Guarantee

The model does not know everything about the new student.

Other factors such as prior knowledge, exam difficulty, concentration, sleep, and many other variables could affect the final result.

Therefore, the model's prediction is an estimate, not a guaranteed outcome.

Key Idea

Supervised Learning uses examples with known answers to learn how inputs are related to outputs.

🔑 Remember the Pattern


📚 Labeled Data
      ↓
🤖 Learn From Examples
      ↓
🧠 Trained Model
      ↓
📥 New Data
      ↓
📊 Prediction

This same idea can be used for tasks such as spam detection, house-price prediction, image classification, and many other Machine Learning problems.

Next, we'll look at a different approach where the data does not come with known answers: Unsupervised Learning.

Unsupervised Learning

Unsupervised Learning is a type of Machine Learning where the system works with data that does not have predefined labels or known answers.

Instead of telling the model what the correct answer is, we give it data and ask it to discover useful patterns, relationships, or groups within that data.

🔍 No Known Answers

In Supervised Learning, the training data contains known answers. In Unsupervised Learning, those answers are not provided.

For example, imagine an online store has information about thousands of customers. The store may know things such as what customers purchased, how often they purchased, and how much they spent.

But the store may not already know which customers belong to which groups.


📊 Customer Data
        │
        ▼
🤖 Unsupervised Learning
        │
        ▼
🔍 Find Patterns
        │
        ▼
📦 Discover Groups

👥 Customer Grouping

An Unsupervised Learning algorithm can analyze customer behavior and discover groups of customers with similar characteristics.

For example, it might discover groups such as:

🛍️ Frequent Shoppers

Customers who purchase products regularly.

💰 High-Spending Customers

Customers who tend to make larger purchases.

🆕 Occasional Shoppers

Customers who purchase products less frequently.

The important point is that nobody had to provide these groups as predefined labels.

The algorithm attempts to discover meaningful structure within the data.

📊 Clustering

One common Unsupervised Learning technique is called clustering.

Clustering attempts to organize similar data points into groups while separating data points that are less similar.


📊 Unlabeled Data

● ● ●       ▲ ▲ ▲
● ● ●       ▲ ▲ ▲
  ●           ▲

        + 

      ■ ■ ■
      ■ ■ ■

        ↓

🤖 Clustering

        ↓

📦 Group 1
📦 Group 2
📦 Group 3

🎯 What Is the Goal?

The goal of Unsupervised Learning is not to predict a known answer.

Instead, the system attempts to discover structure, relationships, or patterns that are already present in the data.

Supervised Learning

📚 Data + Known Answers → Learn to Predict

Unsupervised Learning

📊 Data Without Known Answers → Discover Patterns

Next, we'll use a simple example to see how Unsupervised Learning can discover groups from data.

A Simple Unsupervised Learning Example

Let's understand Unsupervised Learning using a simple customer segmentation example.

Imagine an online store has information about its customers, including how often they purchase products and how much they usually spend.

However, the store does not already know which customers belong to which groups.

📊 Customer Data

Customer Purchases Average Spending
Customer A Very Often High
Customer B Often High
Customer C Rarely Low
Customer D Rarely Low
Customer E Sometimes Medium

🔍 Finding Groups

We don't tell the Machine Learning system what the customer groups should be.

Instead, the system analyzes the available data and looks for customers with similar behavior.


📊 Customer Data
        │
        ▼
🤖 Unsupervised Learning
        │
        ▼
🔍 Compare Similarities
        │
        ▼
📦 Discover Groups

👥 Possible Groups

💰

High-Value Customers

Customers who purchase frequently and spend more.

🛍️

Regular Customers

Customers who purchase products at a moderate frequency.

🌱

Occasional Customers

Customers who purchase less frequently and spend less.

These groups are examples of what an algorithm might discover. The exact groups depend on the data and the algorithm being used.

🧠 What Makes This Unsupervised?

The key point is that we did not provide labels such as "High-Value Customer", "Regular Customer", or "Occasional Customer" before training.

The system is trying to discover structure in the data by itself.

Supervised Learning

📚 Examples + Known Labels → Learn to Predict Labels

Unsupervised Learning

📊 Data Without Labels → Discover Groups or Patterns

⚠️ The Groups Are Not Automatically Meaningful

There is an important detail beginners often miss.

An algorithm can create groups, but humans may still need to examine those groups and determine whether they are actually useful.

For example, discovering three customer groups does not automatically mean that those three groups are the best way for the business to understand its customers.

Key Idea

Unsupervised Learning looks for useful patterns or structure in data without being given predefined labels.

Next, we'll learn about the third major type of Machine Learning: Reinforcement Learning.

A Simple Reinforcement Learning Example

Let's understand Reinforcement Learning with a simple example: teaching a computer to move through a game.

Imagine a small game where an AI-controlled character needs to reach a goal while avoiding obstacles.

🎮 The Environment

The game board is the environment. The AI can observe its current position and choose an action.


┌───────┬───────┬───────┬───────┐
│       │       │       │ 🏆    │
├───────┼───────┼───────┼───────┤
│       │   🧱  │       │       │
├───────┼───────┼───────┼───────┤
│ 🤖    │       │       │       │
└───────┴───────┴───────┴───────┘

🤖 = Agent
🧱 = Obstacle
🏆 = Goal

🤖 The Agent Takes an Action

The AI might choose to move left, right, up, or down.


🤖 Agent

      ⬆️
⬅️    🤖    ➡️
      ⬇️

Choose an Action

The result of the action determines what happens next.

🏆 Rewards and Penalties

Suppose the AI reaches the goal. The system gives it a positive reward.


🤖 ────────► 🏆
             │
             ▼
        🏆 Positive Reward

Now suppose the AI moves into an obstacle. The system could give it a penalty.


🤖 ────────► 🧱
             │
             ▼
        ❌ Penalty

🔄 Learning Through Repeated Attempts

At the beginning, the AI may make many poor decisions. It does not immediately know the best path.

By repeatedly interacting with the environment, it receives feedback and gradually learns which actions tend to produce better results.


Try Action
    ↓
Observe Result
    ↓
Receive Reward / Penalty
    ↓
Learn From Feedback
    ↓
Try Again
    ↓
Improve Behavior

🎯 What Does the AI Learn?

Over many attempts, the system can learn that some actions are more useful in particular situations than others.

Eventually, it may discover a strategy that allows it to reach the goal more effectively.


Early Attempts

🤖 → 🧱 ❌
🤖 → 🧱 ❌
🤖 → 🏆 ✅


Later Attempts

🤖 ────────► 🏆
       ✅

🌍 Real-World Applications

The same basic idea can be used in more complex situations.

🎮

Games

AI agents can learn strategies by interacting with games and receiving feedback.

🤖

Robotics

Robots can learn useful behaviors through interaction with their environment.

⚠️ Important Point

Reinforcement Learning is not simply about receiving a reward after every action.

The system needs to learn which actions and strategies produce better long-term results.

Key Idea

Reinforcement Learning teaches an agent through interaction, feedback, rewards, and penalties.

Now that we've seen all three major approaches, let's compare them side by side.

Example of Reinforcement Learning

A robot learning to navigate a maze or a game-playing agent learning to improve its moves is a classic example.

The system learns from rewards when it makes good choices and penalties when it makes poor ones.

Comparing the Three Types of Machine Learning

We have now looked at Supervised Learning, Unsupervised Learning, and Reinforcement Learning.

The easiest way to understand the difference is to focus on what kind of feedback the system receives while learning.

👨‍🏫 Supervised Learning

The system learns from examples where the correct answer is already known.


📚 Labeled Data
      ↓
🤖 Learn From Examples
      ↓
🧠 Model
      ↓
📥 New Data
      ↓
📊 Prediction

Think: A teacher gives you examples together with the correct answers.

🔍 Unsupervised Learning

The system receives data without predefined answers and attempts to discover patterns or groups.


📊 Unlabeled Data
      ↓
🤖 Analyze Data
      ↓
🔍 Find Patterns
      ↓
📦 Discover Groups

Think: You receive a large collection of information and try to discover how it is organized.

🎮 Reinforcement Learning

The system learns by interacting with an environment and receiving feedback through rewards or penalties.


🤖 Agent
   ↓
🎮 Action
   ↓
🌍 Environment
   ↓
🏆 Reward / ❌ Penalty
   ↓
🧠 Learn
   ↓
🔄 Try Again

Think: You learn by trying different actions and discovering which actions produce better results.

⚖️ Side-by-Side Comparison

Type Learning From Main Goal Example
👨‍🏫 Supervised Labeled data Predict known types of outcomes Spam detection
🔍 Unsupervised Unlabeled data Discover patterns or groups Customer segmentation
🎮 Reinforcement Actions and feedback Learn better behavior over time Game-playing agent

🧠 An Easy Way to Remember

👨‍🏫

Supervised

Known Answers

Learn from labeled examples.

🔍

Unsupervised

Find Patterns

Discover structure in unlabeled data.

🎮

Reinforcement

Learn From Feedback

Improve actions using rewards and penalties.

Important

These three categories are useful foundations, but real Machine Learning systems can be more complicated.

Some systems can combine different techniques, and the best approach depends on the problem, the available data, and the desired outcome.

Now let's review the most important ideas from this lesson.

What You Learned

Congratulations! You have completed Lesson 10.

You now understand the three major approaches to Machine Learning and how they differ from one another.

👨‍🏫 Supervised Learning

Supervised Learning uses labeled examples where the correct output is already known.

The model learns the relationship between inputs and outputs and uses that knowledge to make predictions on new data.

🔍 Unsupervised Learning

Unsupervised Learning works with data that does not have predefined labels.

The system attempts to discover useful patterns, relationships, or groups within the data.

🎮 Reinforcement Learning

Reinforcement Learning involves an agent interacting with an environment.

The agent learns from actions and feedback such as rewards and penalties.

⚖️ The Main Difference

The easiest way to remember the three approaches is to focus on how the system learns.


👨‍🏫 Supervised
Known Answers
      ↓
Learn to Predict

🔍 Unsupervised
No Known Answers
      ↓
Discover Patterns

🎮 Reinforcement
Actions + Feedback
      ↓
Improve Behavior

🌍 Different Problems Need Different Approaches

There is no single Machine Learning approach that is best for every problem.

The right approach depends on the problem, the available data, and the desired outcome.

Remember It This Way


📚 Supervised
"Here are examples with answers."

🔍 Unsupervised
"Here is data. Find useful patterns."

🎮 Reinforcement
"Try actions and learn from feedback."

        

The most important idea from this lesson is:

Supervised Learning learns from labeled examples, Unsupervised Learning discovers patterns in unlabeled data, and Reinforcement Learning learns through actions and feedback.

In the next lesson, we'll go deeper into how a Machine Learning model is trained and how we evaluate whether it is actually learning useful patterns.

Next Lesson

Congratulations! You have completed Lesson 10.

You now understand the three major types of Machine Learning: Supervised Learning, Unsupervised Learning, and Reinforcement Learning.

You also learned that each approach is designed for different kinds of problems and uses different forms of learning or feedback.

How Does a Machine Learning Model Learn?

In the next lesson, we'll go one step deeper and understand what actually happens when a Machine Learning model learns from data.

Lesson 11

Training a Machine Learning Model

Learn how training data is used, how a model finds patterns, what training means, and why testing is necessary to determine whether a model can work well on new data.

Continue to Lesson 11 →