Introduction-to-Machine-Learning
Introduction-to-Machine-Learning
Learning
45 minutes
Overview Objectives
In this lesson students are introduced to a form of artificial Students will be able to:
intelligence called machine learning and how they can use
the Problem Solving Process to help train a robot to solve Apply the Problem Solving Process
problems. They participate in three machine learning to train a computer to solve a
activities where a robot - A.I. Bot - is learning how to detect problem
patterns in fish.
Question of the Day: How can we use the Problem Solving Preparation
Process to solve a problem with machine learning?
Review the Code Studio levels
before the lesson
Standards Full Course Alignment Print copies of the activity guide
for each student
AI4K12 National Guidelines 2021
Check the "Teacher's Lounge"
BI-3 - Computers can learn from data forum for verified teachers to find
additional strategies or resources
CSTA K-12 Computer Science Standards (2017)
shared by fellow teachers
AP - Algorithms & Programming
IC - Impacts of Computing
Links
Agenda Heads Up! Please make a copy of
any documents you plan to share
Before the Lesson
with students.
Preparing for the Unit
Vocabulary
Machine Learning - How
computers recognize patterns and
make decisions without being
explicitly programmed
Teaching Guide
Getting Started with Code.org: Consider watching our Getting Started with Code.org video series for an
overview of how to navigate lesson plans, setup a classroom section, and other important features of the
Code.org platform. Each video also has a support article if you'd prefer to read or print instructions - click
here to learn more.
Setup a Classroom Section: You can use a class section in Code.org to manage your students, view their
progress, and assign specific curriculum - click here to learn more.
If you are using a learning management system, there may be additional steps to sync your classes with
Code.org:
Click here for steps to setup your classes with Google Classroom
Click Here for steps to setup your classes with Clever
Become a Verified Teacher: Lesson plans and levels have additional resources and answer keys for Verified
Teachers, which is quick process that verifies your position at an educational institution. Click here to
complete a form and you should have access to verified teacher resources in ~1 business day. Verified
teachers also have access to the "Teacher's Lounge" section of the forums.
Get Inspired: Consider watching our Teacher Tips video playlist, featuring current CS Discoveries teachers.
Technical Requirements: For the very best experience with all Code.org content, we recommend
consulting with your school or district's IT department to ensure specific sites are allowed and are not
blocked. Click here to see a list of sites to unblock.
You can also find mobile and tablet support details, hardware recommendation information such as
minimum Internet connection speed, smallest screen size supported, and other hardware
recommendations, as well as a list of supported browsers and platforms at the same technical
requirements website.
Prompt: Today we begin a unit on Artificial Intelligence, or AI. What’s an example of AI either in your
personal life or that you’ve seen in a movie or book?
Teaching Tip
What Is AI? At a basic level, artificial intelligence is when a computer program mimics the intelligence of
a human being. This can appear as solving a problem, engaging in conversations, displaying emotions,
and many other forms. Shortly after this prompt, students will watch a video that further defines AI and
the focus of this unit, Machine Learning.
Have students brainstorm silently on their own, then share with their neighbors, and finally share with the
whole class.
Discussion Goal: Try to surface any personal connections students may already have with AI. Students may
come up with examples from their personal lives, such as recommendation systems or facial recognition. Or
they may think of examples in the media, such as the robots in movies like Wall-E or personal assistants like
Siri. Students may also come up with examples that aren’t strictly AI - for now, add them to the list anyway.
Keep track of any suggestions that students surface without validating them as right or wrong - let
students brainstorm freely first.
Display: Display the slide with the large venn diagram that includes AI and many applications.
Remarks
Artificial Intelligence is used in a lot of different places in our lives - from facial recognition in our phones
to personal recommendations when we browse the web, and even in driverless cars. For the next few
weeks, we’re going to focus on a specific type of artificial intelligence called machine learning.
Video: Show students the AI: What is Machine Learning? video in the slides
Teaching Tip
Videos are used throughout the curriculum to spark discussions, supplement key concepts with
additional explanations and examples, and expose students to the various roles and backgrounds of
individuals in computer science.
While interacting with the video, turn on closed captioning so students can also read along as they
watch.
To encourage active engagement and reflection, use one or more of the strategies discussed in the
Guide to Curriculum Videos.
Machine Learning: How computers recognize patterns and make decisions without being explicitly
programmed
Remarks
Machine learning helps us solve important problems in society. In the next few weeks, we’ll look at how
we can create our own machine learning apps to solve problems. To help accomplish our goals, we will
use the Problem Solving Process - Define, Prepare, Try, Reflect, and always Empathize. Let's take a look
at how these steps appear for Machine Learning in particular
Display: Show the slide with the Problem Solving Process. Read through the additional lines that
represent how the process connects to Machine Learning.
Question of The Day: How can we use the Problem Solving Process to solve a problem with machine
learning?
Assessment Opportunity
The responses in the activity guide can be used to formatively assess how well students have met the
objectives of the lesson.
Code Studio: In front of the classroom, navigate to Level 1 in Code Studio - Recognizing Fish.
1 Recognizing Fish
Do This: As a class, go through this level which guides you through the process of training A.I. Bot to
recognize fish. As you do, fill in the first part of the activity guide as a class. Consider the following
strategies at different stages of the level:
Teaching Tip
A.I. Bot and Pronouns: These levels purposefully use A.I. Bot’s full name and avoid gendering A.I. Bot as
“he” or “she”. Even though some AI systems take on personified gendered roles - such as Siri or Jarvis -
actual machine learning programs don’t have genders because they’re just computer programs. Model
this same behavior with students by referring to A.I. Bot by it’s full name or using “it” as its pronoun.
Activity As a Class
Testing Screen
Evaluation Screen
Discuss: If we wanted A.I. Bot to become better at recognizing fish, how do you think we could help it do
that?
Discussion Goal: Help students understand that A.I. Bot learns better when it has more examples. The best
way we can improve its ability to recognize fish is by giving it more examples to look at. Students may also
make the connection that this is how humans learn, especially young children - the more examples we
have, the better we learn.
Remarks
This is one example of how the Problem Solving Process and Machine Learning can be used to solve a
problem. We prepared our data, used it to train A.I. Bot, then reflected on the results and decided what
to do next. In this next level, you will follow this process and train A.I. Bot to detect certain kinds of fish -
like red fish or blue fish or triangle fish.
Code Studio: Have students navigate to Code Studio Level 2 - Recognizing Fish Features. This level lets
students train A.I. Bot to recognize a fish by its color or body type.
Do This: Have students choose a word that they want to train A.I. Bot to recognize, and record this
information on their Activity Guide. Students should progress through the level on their own, recording
information on their activity guide.
Circulate: Check that students are filling in their activity guide as they complete the stages. After briefly
checking in with each student, complete this stage yourself in front of the room and pause at the last
screen.
Teaching Tip
Activity Guides and Code Studio: Students may struggle initially to keep track of information on their
activity guide as they complete levels in Code Studio. One way to help students think about this is
similar to being a scientist performing a lab experiment: they are performing an experiment in Code
Studio, and keeping track of their results in their Activity Guide. This is a pattern that will continue
throughout the unit, so this is a great opportunity to help students manage both the activity guide and
Code Studio.
Display: As students reach the final stage, have them press the white Information icon in the upper-right
corner. This displays the features that A.I. Bot is using to help make its decision. In the example here, A.I.
Bot has learned that the color matters the most when making a decision and the eyes matter the least.
Have students record the most important and least important features on their activity guide.
Discuss: What features did A.I. Bot think were the most important? Are those the features you were
expecting to be most important?
Discussion Goal: Students may find that A.I. Bot thinks some features are important when they’re actually
completely unrelated to their word. For example, thinking that the mouth of a fish is important when trying
to determine if the fish is red. Students can verify this by looking for patterns in the fish that A.I. Bot has
accepted - maybe all of their example fishes happened to have the same type of mouth and A.I. Bot
mistakenly thought this was important.
Remarks
Some of you noticed that A.I. Bot was learning about parts of the fish that aren’t actually important, like
the mouth or eyes or dorsal fin. This happens in real life too - machines can learn patterns we don’t intend
even with lots of data, which can cause A.I. Bot to make mistakes. For this situation, it’s pretty easy to tell
if A.I. Bot made a mistake - we can quickly see if a fish isn’t actually red or circular. Let’s try a slightly
harder challenge - trying to recognize expressions!
Code Studio: Have students navigate to Code Studio Level 3 - Recognizing Fish Expressions. This level
lets students train A.I. Bot to recognize a fish by its expression, such as “silly” or “serious” or “angry”.
3 Recognizing Expressions
Do This: Have students choose an expression that they want to train A.I. Bot to recognize, and record
this information on their Activity Guide. Students should progress through the level on their own, recording
information on their activity guide. On the final screen, have students press the information icon and record
the features that A.I. Bot learned were most important.
Circulate: Check that students are filling in their activity guide as they complete the stages. Ask students
what features they’re looking at to determine if a fish meets their criteria. Students will probably say they
primarily use eyes and mouth to help determine expression, but when they click the Information icon on
the final screen, A.I. Bot may be using additional features such as color and body to make its decision.
Prompt students to think about how they feel about this and compare it to their personal experience - For
example, if someone thought they were “silly” or “angry” primarily based on their clothing.
Display: Show the slide of A.I. Bot learning how to identify fish as “Angry”. Have students discuss the
prompt on the screen: Looking at this screen, why do you think color appeared as the second most
important feature?
Discussion Goal: Students should notice that even though the eyes and mouth tend to appear “angry” on
every fish, there also appears to be a lot of purple fish on the screen. As a result, A.I. Bot may start to think
that the color “purple” is another way to tell if a fish is angry or not.
Discuss: Do you think it’s okay to consider a fish “angry” by its color?
Discussion Goal: For the first part of the question, guide students to notice that there are a lot of purple
fish on the screen so A.I. Bot might think that purple fish are more likely to be angry than other fish.
Teaching Tip
Job Interviews: If there is time available, consider showing students Objective or Biased: On the
questionable use of Artificial Intelligence for job applications. This is a real-life example of a similar
situation where unintended factors, such as wearing glasses or a headscarf, are influencing how an AI
system rates job applicants. This can be a useful resource to make a connection between this fish
activity and the real-world, but this resource is not designed for a middle-school audience and requires
some adjustments and decisions for how to best present to your students.
The second part of the question is more open-ended. Students should explore their own ideas and feelings
about whether this kind of labeling is appropriate based on the color of the fish. In particular, A.I. Bot has
learned “purple fish are angry fish”, which students may have strong reactions to. They may describe
similar situations outside of the classroom, such as moments where they’ve been judged by their
appearance, gender, or race, to help explain their opinions. This question is designed to start a
conversation and connect students’ experiences to the potential pitfalls of machine learning, and it’s okay if
the discussion doesn’t come to a firm conclusion. You can let students know that they will continue to learn
about and discuss these issues in the rest of the unit. Use the remarks below to help wrap up the
discussion.
Remarks
Even with a small example like this, we see that machine learning can get into trouble and learn
something that’s harmful to a particular type of fish. Having more data and making sure it represents all
types of fish can help solve this problem. These types of examples happen in real life too and can have
serious consequences, such as whether or not you receive medical care or get a job offer. Throughout
this unit, as we learn how to use machine learning to solve problems, we need to always be thinking
about: What is the impact, and who is being included or excluded?
Wrap Up (5 minutes)
Reflection
Code Studio: Have students answer 5 quick survey questions at the beginning of this unit on AI and
Machine Learning. Once at least 5 students have completed the survey you will be able to view the
anonymized results in the Teacher Dashboard. Some of these questions will be asked again at the end of
the first project, which can be helpful in seeing student growth and shifts in attitudes throughout the unit.
4
Check-In Survey
Journal
Prompt: What is something new you learned about machine learning today? What is a new question
you have about machine learning?
Encourage students to choose one of these to share with you on the way out the door, or to write their
responses on a post-it note that can be displayed in the classroom. If possible, keep track of these items
throughout the unit and refer back to them in later lessons when they are addressed.
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.