< Unit 7 - AI and Machine Learning ('22-'23)

Lesson 2: Types of Machine Learning

45 minutes

Overview

In this lesson students will consider how they create “mental” models when learning new concepts, and how those can be similar to a “machine learning” model. They participate in a color pattern activity to simulate building a machine learning model without help, then they play a game called "Green Glass Door" as an example of supervised learning, and finally, they will sort several scenarios into “supervised” or “unsupervised” learning.

Question of the Day: What are different types of machine learning?

Purpose

  • Review the Code Studio levels before the lesson so you know how to play the game called “the Green Glass Door”
  • Print or prepare to share online copies of the activity guide for each student

Assessment Opportunities

  1. Describe the differences between supervised and unsupervised learning.

    Check student responses on the activity guide at the end of the class period.

AI4K12 National Guidelines 2021
      • 3-A-i.6-8 - Contrast the unique characteristics of human learning with the ways machine learning systems operate.
      • 3-A-i.9-12 - Define supervised, unsupervised, and reinforcement learning algorithms, and give examples of human learning that are similar to each algorithm.

Agenda

Objectives

Students will be able to:
  • Describe the differences between supervised and unsupervised learning.

Preparation

  • Review all materials for today’s lesson.
  • Check the "Teacher's Lounge" forum for verified teachers to find additional strategies or resources shared by fellow teachers

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the teachers
For the students

Vocabulary

  • Features - The inputs that a model uses to make decisions
  • Label - the output you are trying to decide or predict with a model
  • Model - a computer program designed to make a decision
  • Supervised Learning - When a human trains a model to learn with examples
  • Training - giving examples to a model so it can learn
  • Unsupervised Learning - Finding patterns in data that doesn't have any labels

Teaching Guide

Warm Up (5 minutes)

Journal Prompt

Prompt: Think of a skill you commonly use, like speaking, tying your shoes, cooking, or playing a game. How did you learn this skill?

Allow students a minute or two to write their responses, then ask for volunteers to share their ideas with the class. As students share, keep a list of themes that emerge in the front of the room.

Discussion Goal: Hopefully student responses will fall into one of three categories:

  • They learned it with the help of someone else (like tying your shoes or playing an instrument)
  • They learned it on their own just by observation and chance (like how to speak, or hidden rules like if a family member has you take your shoes off before entering a house)
  • They learned it through trial and error and adjusting based on their mistakes (like scoring a goal or shooting a ball in certain sports, or improving at a game)

Remarks

This is a great list, and we can see there are a variety of ways that we learn new things as humans. Today, we’re going to talk more about how computers learn new things and think about how they might be similar or different from how we learn.

Question of the Day: What are different types of machine learning?

Activity (35 minutes)

Preparation: Have students keep their journal out so they can take notes on the vocabulary from today.

Teaching Tip

Vocabulary: This lesson introduces a lot of vocabulary that is used throughout the unit. Introducing it early gives students a chance to familiarize themselves with these terms so they can begin using them to describe their work. But, it's still a lot of vocabulary, which can be challenging. Consider some of the following strategies to help students internalize these words:

  • Create a Word Wall that contains the word, a definition, and a drawing illustrating the concept
  • Have students record each vocabulary word in their journal along with a sketch
  • Have students read the slides aloud and practice saying the vocabulary words as they are presented.

Unsupervised Learning (10 minutes)

Display: Show the next slide, which displays a graphic comparing A.I. Bot and a human brain.

Remarks

When we learn something new, we create a “Mental Model” in our brain to help represent information and break it down into pieces. For example, when learning about the solar system, we think of small orbs rotating around each other to represent the planets. Computers do this too - when they learn something new, they create a “Machine Learning Model” to help represent the information. This model helps them make a decision. Yesterday, we helped A.I. Bot develop a model for deciding whether something is a fish or not.

Vocabulary:

  • Model: a computer program designed to make a decision

Remarks

We’re going to simulate how a computer might create it's first model to learn someting new. In this example, we don't really know what we're learning yet - much like a young child, we’re trying to notice patterns and see what we can discover.

Distribute: Pass out a copy of the Types of Machine Learning Activity Guide to each student. Students will use this activity guide while working through levels in Code Studio.

Teaching Tip

Answer Keys & Exemplars: An answer key or exemplar is provided for verified teachers as part of the resources in this lesson plan. If you do not see an answer key or exemplar listed as a resource, follow these steps to become a verified teacher.

Code Studio: Have students log into Code Studio. Students will follow the directions on the level, clicking and dragging to group the rectangles together in whatever way makes sense to them. After completing this and pressing the “Next” button, students will see that they’ve created groupings of colors. Remind students to complete the activity guide as they work through this level.

Teaching Tip

Colors and Data: The triplets of numbers in each box represents Red, Green, and Blue color values. Students may have seen this before in previous units, but it's also okay if they haven't - that's what makes this an example of unsupervised learning. After the lesson, if students want to learn more about colors and data, consider showing them this video on colors and pixels to help explain what is happening.

Discuss: What groupings did you create? Is there a pattern?

Discussion Goal: Have several students share or call on a few that you noticed while circulating around the classroom. Students may find that they unintentionally grouped cards together by color (red, green, blue) or by shade (light vs dark) or other factors. It’s okay for students to have many different answers to this, and it’s also okay for students to not have any noticeable patterns.

Vocabulary:

  • Unsupervised Learning: Finding patterns in data that doesn't have any labels
  • Features: The inputs that a model uses to make decisions

Remarks

This is really fascinating! Just by grouping similar numbers together, we were able to find patterns and create different color groupings. This is an example of Unsupervised Learning, where we were able to learn something using just the data itself. The only thing we paid attention to were the numbers on the cards, called the features. This is similar to how online recommendations work - computers try to find patterns in the items we buy so they can suggest new items for us.

Discuss: Which examples from the warm-up are similar to unsupervised learning?

Have students reflect on the examples shared during the warm-up, trying to identify which ones are are likely to be unsupervised learning. Try to identify situations where students were noticing patterns without clear directions, such as the unspoken rules of their home or community. They will likely think of situations from when they were much younger, especially when they thought they learned something from observation, but it didn't actually end up being true.

Supervised Learning (10 minutes)

Remarks

Unsupervised Learning is one way that computers can learn something new. But this isn't like what we did yesterday - yesterday we helped the computer learn something new by providing examples. This is like when you get older and a coach or mentor can help teach you something new. In the next level, we're going to try and learn something new with somebody's help.

Code Studio: Have students continue to the next level in Code Studio, where they will play a game called the Green Glass Door. The goal is to notice patterns in different types of words to try and get words accepted through the door.

Circulate: Check in with students as they complete this activity. This activity can frustrate students, especially if they’re not sure what to be looking for. Encourage students to click the “See all results” button to see which words have been accepted and which words have been rejected. Help them notice what all the accepted words have in common, and what makes them different from the rejected works. If students figure out the secret early, encourage them to keep it a secret until the class discussion.

Remind students to complete the activity guide as they work through this level.

Teaching Tip

Green Glass Door: The secret of the game is: words with double letters are accepted and all others are rejected. Some students may have seen this game before - if so, encourage them to keep the secret to themselves until others have discovered it. If students get stuck, encourage them to look at the name of the game - green, glass, and door all have two of the same letters in a row and will be accepted.

Discuss: What’s the secret - which words are accepted or rejected? How did you figure it out?

Discussion Goal: This should be an exciting moment, as students finally share the secret to how the game works. Ask a few students to share how they figured out the secret. Focus on responses that highlight how they looked for similarities within each group (like noticing the double letters) and differences between groups. Highlight how the wizard was helpful in noticing the pattern - without their examples, it would have been a lot more difficult to determine the pattern.

Vocabulary: These words are spread across two slides. Use the visualizations to help explain each concept as students record the vocabulary in their notes.

  • Supervised Learning - When a human trains a model to learn with examples.
  • Label - the output you are trying to decide or predict with a model
  • Training - giving examples to a model so it can learn

Remarks

This activity is an example of Supervised Learning, where we learn something new by looking at examples. The wizard was helping to train us by providing labels for each of the words - either accept or reject. After looking at enough examples, we can start to figure out the pattern ourselves. This is similar to the activity we did yesterday, or when you’re asked to identify street lights or stop signs from an image - we’re helping to train a driverless car by providing more data.

Discuss: Which examples from the warm up are supervised learning?

Discussion Goal: Have students reflect on the examples shared during the warm-up, trying to identify which ones are supervised learning. Help students understand that the key distinction is that learning happens by examples from someone who is helping or coaching during the learning.

Supervised and Unsupervised Learning (15 minutes)

Do This: On the second page of the activity guide, students are given several scenarios to identify as supervised or unsupervised learning. Have students read through the scenarios and complete the task individually, then have students pair-up to compare answers and talk through their reasoning.

Circulate: Monitor students as they complete this activity, checking that they can reason through the differences between supervised and unsupervised learning. An answer key is provided to help check student responses.

Teaching Tip

Human Learning vs Machine Learning: These scenarios are provided as a way for students to think about how their own learning experiences may be similar to machine learning and to help internalize the vocabulary in this lesson, but human learning and machine learning are still fundamentally very different.

For now, guide students to see how scenarios where someone is learning by training with a teacher or mentor is similar to Supervised Learning, and scenarios where they learn independently by drawing their own conclusions is similar to Unsupervised Learning.

Display: Cycle through the next several slides and invite students to share their responses. This is an opportunity to have a discussion about each scenario and hear why students think certain scenarios are similar to supervised or unsupervised learning.

Discussion Goal: These discussion are less about being absolutely right or wrong, and more about the reasoning being used to compare why certain situations are supervised or unsupervised. Encourage students to discuss with each other, especially if they disagree about a certain scenario. Students may be unsure about some scenarios, which is a good opportunity to clarify the differences between supervised and unsupervised learning as a full class.

Remarks

Today we've seen two examples of machine learning, and how they can be similar to some of our own learning experiences as humans. Tomorrow, we'll have a chance to research examples of machine learning and see how this type of learning can be used to solve problems in the world.

Wrap Up (5 minutes)

Journal

Discuss: How are human learning and machine learning similar? How are they different?

Discussion Goal: This is an opportunity to summarize the learning from today and apply vocabulary correctly. While discussing, try to have students use the vocabulary from the lesson (feature, label, training, etc) correctly.

Have students record their thoughts in their journals, and invite a few students to share their examples with the class.

Assessment Opportunity

Formative Assessment: Reading through student responses to this prompt can help determine how well students internalized the differences between supervised and unsupervised learning. The activity guide from today can also be used as a formative assessment with students.

Creative Commons License (CC BY-NC-SA 4.0).

This work is available under a Creative Commons License (CC BY-NC-SA 4.0).

If you are interested in licensing Code.org materials for commercial purposes contact us.