Unit 2: Machine Learning Basics

Lesson 2: Supervised Learning (1 hour)

Lesson content from Unit 2: Machine Learning Basics

Lesson 2: Supervised Learning (1 hour)

Learning Objectives

  • Understand what supervised learning is
  • Recognize supervised learning examples
  • Understand classification and regression
  • Experience supervised learning through hands-on activity

Materials Needed

  • Internet-connected devices
  • Teachable Machine (teachablemachine.withgoogle.com)
  • Examples of supervised learning (images, datasets)
  • Student notebooks
  • Pre-prepared dataset or examples

Time Breakdown

  • Review previous lesson (5 min)
  • Introduction to supervised learning (15 min)
  • Classification vs. Regression (15 min)
  • Hands-on: First ML model (20 min)
  • Wrap-up (5 min)

Activities

1. Review (5 min)

  • What is machine learning?
  • How is it different from traditional programming?
  • Share homework examples

2. Introduction to Supervised Learning (15 min)

  • Definition: Supervised learning uses labeled data (data with answers) to learn patterns
  • Key Concept: It's like learning with a teacher who shows you examples and tells you the correct answer
  • Process:
    1. Collect labeled data (examples with correct answers)
    2. Train the model (show it the examples)
    3. Test the model (see if it learned correctly)
    4. Use the model (make predictions on new data)

Real-World Examples:

  • Email spam detection (labeled: spam/not spam)
  • Image recognition (labeled: cat/dog/horse)
  • Medical diagnosis (labeled: disease/no disease)
  • Price prediction (labeled: house prices)

Key Terms:

  • Training data: Examples used to teach the model
  • Labels: The correct answers (spam/not spam, cat/dog, etc.)
  • Features: What the model looks at (words in email, pixels in image)

3. Classification vs. Regression (15 min)

Classification (Categorical answers):

  • Predicting categories or groups
  • Examples:
    • Is this email spam? (Yes/No)
    • What animal is this? (Cat/Dog/Bird)
    • Will it rain? (Yes/No)
    • What type of flower? (Rose/Tulip/Sunflower)
  • Output: Categories or labels

Regression (Numerical answers):

  • Predicting numbers
  • Examples:
    • What will the temperature be tomorrow? (72°F)
    • How much will this house cost? ($250,000)
    • How many hours will this take? (3.5 hours)
  • Output: Numbers

Activity: Classify examples

  • Show 10 scenarios, students identify classification or regression:
    1. Predicting house price (Regression)
    2. Identifying if image is a cat (Classification)
    3. Predicting stock price (Regression)
    4. Detecting if email is spam (Classification)
    5. Predicting age from photo (Regression)
    6. Identifying handwritten digit (Classification)
    7. Predicting test score (Regression)
    8. Recognizing emotion (Classification)
    9. Predicting sales amount (Regression)
    10. Identifying language (Classification)

4. Hands-On: Build Your First ML Model (20 min)

Using Teachable Machine (Image Classification)

  1. Introduction (5 min)

    • Navigate to teachablemachine.withgoogle.com
    • Explain: We'll train a model to recognize images
    • Show interface basics
  2. Create a Simple Model (15 min)

    • Project: Classify objects (e.g., water bottle, pencil, phone)
    • Step 1: Collect training data
      • Class 1: Take 20-30 photos of water bottle
      • Class 2: Take 20-30 photos of pencil
      • Class 3: Take 20-30 photos of phone
    • Step 2: Train the model
      • Click "Train Model" button
      • Watch it learn (30-60 seconds)
    • Step 3: Test the model
      • Use webcam or upload test images
      • See predictions in real-time
    • Step 4: Experiment
      • Try confusing examples
      • What happens with new objects?
      • What are the limitations?
  3. Reflection Questions:

    • Did it work? How accurate was it?
    • What made it easier or harder for the model?
    • What would happen with more training data?
    • What would happen with different lighting/angles?

Alternative if devices limited: Do as demonstration with student participation

5. Wrap-Up (5 min)

  • Key concepts: Supervised learning, classification, regression
  • What did you learn about how ML learns?
  • Preview: Next lesson - Unsupervised learning

Differentiation Strategies

  • Younger students: Focus on image classification, simpler models, more guidance
  • Older students: Explore more complex models, analyze accuracy, experiment with parameters
  • Struggling learners: Work in pairs, use pre-made examples, simpler classification tasks
  • Advanced learners: Research how the training algorithm works, explore different model types, analyze training vs. testing accuracy

Assessment

  • Understanding of supervised learning concepts
  • Successful creation of ML model
  • Quality of observations and reflections
  • Participation in hands-on activity