Module 7 Lesson 2: Machine Learning Basics (Supervised vs. Unsupervised)
How computers learn. Explore the two main pillars of machine learning: learning with a teacher (Supervised) and finding patterns on your own (Unsupervised).
Module 7 Lesson 2: Machine Learning Basics
Machine Learning (ML) is the part of AI that focuses on algorithms. It is essentially Mathematics that improves with experience. There are two main ways a computer can learn: Supervised and Unsupervised. In this lesson, we’ll explore the differences and see real-world examples of each.
Lesson Overview
In this lesson, we will cover:
- Supervised Learning: Learning with labeled data (The Teacher).
- Unsupervised Learning: Finding hidden patterns (The Explorer).
- The Workflow: Features and Targets.
- Common Use Cases: Predicting house prices vs. Grouping customers.
1. Supervised Learning (The Teacher)
In Supervised Learning, you provide the computer with Examples and Answers.
- Example: An email (Input).
- Answer: "Spam" or "Not Spam" (Label).
After seeing 1,000 labeled emails, the computer learns to recognize the indicators of spam on its own.
- Goal: Predict a label or a number.
2. Unsupervised Learning (The Explorer)
In Unsupervised Learning, there are no answers. You give the computer raw data and say: "Find something interesting in here."
-
Clustering: The computer looks at 1 million shoppers and notices that they naturally fall into 3 groups: "Bargain Hunters," "Luxury Buyers," and "Window Shoppers."
-
Goal: Find hidden structures or groups.
3. Features vs. Targets
To build an ML model, we split our data into two parts:
- Features (X): The inputs (e.g., Square footage, Number of bedrooms, Location).
- Target (y): The thing we want to predict (e.g., Price of the house).
4. Real-world Examples
| Type | Scenario | Outcome |
|---|---|---|
| Supervised | Medical Records | Predict if a tumor is malignant (Yes/No). |
| Supervised | Stock Prices | Predict the price of Apple stock tomorrow. |
| Unsupervised | Spotify | Suggest a "Daily Mix" based on similar songs you usually skip. |
| Unsupervised | Cybersecurity | Find "unusual" network behavior that doesn't match normal patterns. |
Practice Exercise: Classify the ML
Identify if the following scenarios require Supervised or Unsupervised learning:
- Predicting the path of a hurricane based on 50 years of previous hurricane data.
- Grouping 1,000 newspaper articles into "Sports," "Politics," and "Finance" without being told which is which.
- Determining if a picture contains a cat or a dog after being shown labeled photos of both.
- Scanning a social media network to find "communities" of users who share the same interests.
Quick Knowledge Check
- What is the main difference between Supervised and Unsupervised learning?
- In the house price example, what would be the "Target"?
- Which type of learning is used for Clustering?
- Why is "Labeled Data" so valuable in the AI industry?
Key Takeaways
- Supervised learning uses "Labeled" data to predict outcomes.
- Unsupervised learning finds "Hidden" patterns in unlabeled data.
- Features are the inputs; Targets are the desired outputs.
- Most AI you use daily (Siri, Netflix, Tesla) is a combination of these techniques.
What’s Next?
We know the theory. Now, let’s see the code! In Lesson 3, we’ll meet Scikit-Learn—the library that makes building these models as easy as three lines of code!