Machine Learning - Session 1 Guide
Contents
Preparation
- Read the Course Overview
- Review the unplugged activity
- Practice the Smart Home activity ahead of time (Ben will send you ML4K logins)
- Assign the following mentor roles (mentors may have multiple roles):
- Timekeeper: know the agenda and be the "MC" for the class, keeping things moving along.
- Attendance Taker: take attendance in Hive (for students and mentors)
- Unplugged activity leader (see below)
- Pair Programming discussion leader (see below)
- Machine Learning intro discussion leader (see below)
- Intro to Python activity leader (see below)
Group Discussions:
Each discussion is outlined in "quote boxes" below. When leading a discussion, be careful to not lecture the students. We've given you prompts in each discussion to help you engage the students. If you're leading a discussion, you can print off or write down the bullet points to help you.
Setup
- Set up laptops with student survey open: https://goo.gl/forms/t8jM04GHrS8MdalH3
- Prepare materials needed for the "My Robot Friends" unplugged activity (these will be provided in the supply bin):
- 1 "Cup Patterns" worksheet and 1 "Algorithm Worksheet" per group of 3-4 students
- At least 6 plastic or paper cups per group
Welcome [30 min]
Volunteer Focus
- Create a welcoming and inclusive environment
- Build a positive relationship with students
- Facilitate student learning
As students arrive
All mentors should be greeting students and introducing themselves.
Have students take the entrance survey once they sit down. After the survey is complete, give the computer to another student, or close the computer so that it doesn't become a distraction.
Make students feel comfortable and welcome. Here are some good conversation starters:
- Did you do anything fun or interesting over the break?
- Have you done any coding before? What did you make?
- What hobbies / activities do you like doing outside of school?
- What are your favorite classes in school?
Warm-up - Unplugged Activity
Split up students in groups of 3 or 4 and do the My Robotic Friends unplugged activity. Students will use a limited set of symbols to write a "program" for their friends to interpret, with the goal being to stack cups in a specific pattern.
Pair Programming Review [5 minutes]
Pair Programming is a vital part of the Bold Idea experience. You might find some students are initially resistant to this "working with a partner" model, however, it's important that we continue to re-enforce teamwork skills throughout the program.
Discussion Leader:
- Ask if any students in the room know what pair programming is. If there are any veteran students in the room, allow them to explain their understanding of it.
- Explain that pair programming is when two people share one computer to write a program together. Even professionals do it!
- Pair Programming has two roles:
- the driver who controls the mouse and keyboard and
- the navigator who follows the reference book to make suggestions, point out errors, and ask questions.
- Watch the Code.org Pair Programming video together as a group.
- Then, ask the students to share what each role does and some dos and don'ts. They'll get practice applying pair programming for the rest of the semester.
Go ahead and pair up students now, and make sure each mentor is working with a pair of students.
Discussion: Intro to Machine Learning [10 min]
Have you ever...
Lead a group discussion on how we interact with ML in our every-day lives. Activity Leader:
- How many of you have used Alexa, Siri, or "Hey Google"? What are some fun commands you can give it?
- Has anyone ever used Google Translate? What kind of situations do you use it?
- Has anyone you ever unlocked a phone or tablet using just your face?
- Has anyone ever asked google maps for directions? What other things is google maps useful for?
What is Machine Learning?
Talk about what Machine Learning is
- All of these systems are built using a technology called Machine Learning.
- With machine learning, to get the computer to perform a complex task, you collect a set of examples of that task being done.
- The computer then learns how to do that task from the examples that it is given.
Engage the group in a discussion about teaching someone to kick a ball:
- How would you teach someone to kick a ball?
- You could tell them specific instructions, like: "swing your leg back", "aim for the ball", "swing your leg forward" etc.
- What's another way you could teach them?
- You could also just show them examples of what it looks like to kick a ball.
- Which way do you think is be best to teach a toddler?
What we'll be doing
Finally, summarize what we'll be doing this semester.
- We're going to show you how to train a computer the same way.
- We'll learn how to:
- Make a smart personal assistant
- Make a program that can tell the difference between nice and mean text messages
- Make a program to organize our images for us
- ...And even how to play a game with us.
Briefly introduce the idea of a model as a type of "brain":
Whenever we train a computer with machine learning, it produces something called a model that we can interact with. Think of the model as the "brains" of the program. We have to train it before we can use it.
Even though we use words like "train" and "teach", remember that these aren't machines with emotions or consciousness. Human brains are much more complex. So don't worry -- you won't be creating a robot that overthrows humans and takes over the world!
Intro to Python [10-15 min]
Activity Leader:
- Can anyone tell me what an algorithm is?
- You just created an algorithm to instruct a computer (or a person acting like one) to stack cups in a specific way.
- Can anyone tell me what language they used to instruct the computer? (someone could say "symbols" or "arrows", etc)
- Those symbols in your algorithm were the language you used to program the computer. Real computers can understand many different types of programming languages.
- Python is one of those languages, however it is much more powerful than just a small set of symbols. You can write Python code using text in a file. We call that a "script".
- We can tell the computer to run that script. The computer then reads your file one line at a time and executes your code until it gets to the last line, and then it stops.
Let's give it a try!
Tell students to find the page in their folders called "Python Scripts and the Python Shell". Have mentors work with students to complete the activities on both sides:
- Creating a new script using the Python IDE
- Writing code directly in the shell
- Making mistakes
Ask students to raise their hand when they see a red error message in the shell.
Activity Leader:
- Take a look at the last red line of the error message. Does anyone want to tell me what error they got?
- Does anyone want to venture a guess as to what that error means, and how we should fix it?
- The shell is also very useful for telling us when something goes wrong. Sometimes, you might run your code and things don't quite work as expected. When this happens, you should check your shell to see if there are any errors.
- That last line of red that starts with "NameError" is really the most important information. The last line is the first thing you should look at when reading error messages.
- Sometimes these errors can be hard to understand, even for us professional coders. But errors are your friend -- don't be afraid of them!
- Does anyone know what you might do when you come across an error you don't know how to solve? Do you give up? Or is there something else you can try?
- When we can't figure something out, we usually go find the answer ourselves.
Have students look in their folders for a page called "Python Scripts and the Shell". That has some useful tips on how to interpret error messages. There's another page called "Common Errors" that might help them later on.
At the end of the activity, students should be trying to create more errors on their own. Have the class share what other error message they came up with. See if you can get them to guess what those mean. There's no right or wrong answers!
Break [5-10 min]
Smart Home Activity [30-45 min]
Have mentors work with students through the Smart Home project worksheet in their folders. The activity is broken down into 3 sections:
- Part 1: Write code to turn lights on and off
- Before running the code, ask your students to predict what will happen. Even if they are complete beginners, encourage them to guess. This helps build confidence in the face of ambiguity.
- Part 2: Add code to turn a fan on and off, then test the code with variations of the same (ie, "turn the light on" instead of "turn on the light")
- At the end of this part, have students reflect on how we could fix it by adding more conditional statements. How many different ways could someone ask you to turn on the lights? How many conditional statements would we need to write?
- Part 3: Update program with Machine Learning, using only 4 if statements.
Reflection Time [5 min]
Have students reflect on their learning experience in their Reflection Journals