Number 3 drawn out.

Machine Learning: Supervised and Unsupervised

Grade 7 - Grade 8

Briana Brownell

Briana Brownell

About the author

Briana Brownell is a Canadian data scientist and technology artist. Her technology-enhanced creative projects span multiple areas, including AI-assisted Shakespearean sonnets, and AI-enhanced, assisted and generated visual art pieces.

Jessa Gamble

Jessa Gamble

About the author

Jessa Gamble is an internationally award-winning science and technology journalist and Penguin Random House author. Her writing has appeared in The Atlantic, Nature, New Scientist and The Guardian.

Introduction

There are many ways to build machine learning programs. In this lesson, students explore two of the basic types of machine learning: unsupervised learning and supervised learning.

Learning Goals

  • Engage in hands-on activities to train a machine in two ways
  • Understand the difference between supervised and unsupervised learning
  • Understand real-world applications of machine learning

Vocabulary

Supervised Learning
A type of machine learning task. If we know what we want the computer to be able to identify, or the categories we want it to distinguish among, this is the type of machine learning we use. The initial data is labelled so the machine can learn which features are shared by data in certain categories. It then generates an algorithm to categorize future, unlabelled data. Humans can check the accuracy of these predictions and get feedback to improve the algorithm. Right now, this is the most common type of machine learning.
Unsupervised learning
Another type of machine learning task. This approach is ideal for identifying general similarities and useful patterns—even the kind that humans don’t tend to notice. Humans do not guide machines to group information, and patterns emerge on their own.

Guiding Questions

  1. Can computers learn? How do they learn? (Answer: Yes, today we’ll look at how to teach computers.)
  2. Can a computer tell the difference between objects? How do they know how to do this? (Answer: Yes, but we need to teach it using examples, or create algorithms to identify patterns to recognise objects.)
  3. Why do computers need people to help them learn? (Answer: We teach computers to identify patterns and recognize objects.)

Curriculum Links

This module aligns with provincial and territorial Computer Science curricula, providing an opportunity for students to explore emerging areas of computer science research. In addition, through the Social Studies curriculum, students have the opportunity to assess the significance of an event (in this case, AI) on people, places and developments at this time in history.


Materials

  • A device (computer / tablet / smartphone) with internet connection and a camera

Computer Activity

Activity 1: Recog (5 minutes)

In this activity, students work as a class on making a machine learning project that teaches a device to identify their handwriting. They will use Google Teachable Machine for the project. The video below shows an example of how this tool can be used. 

Recog is an open-source educational program that can learn to recognize individual handwritten characters. It uses a two-layer neural network to learn new characters and refine its knowledge of those it already knows. Students can hand-train Recog in two ways—supervised or unsupervised—to recognize digits, vowels, arrows in different directions and symbols of their own making. It takes about three examples of each figure for the program to recognize a set of around 10 patterns. Use the following web app Recog.

Students use a pre-trained neural network to see how well it can recognize their handwriting.

Number 3 drawn out.
  1. Draw a letter, number or symbol with the mouse.
  2. Press Digitize to see how the software makes sense of what has been drawn and turns it into a series of squares.
  3. Select the model 0123456789 from the drop-down menu. This is a neural network that has already been trained to recognize digits from 0 through 9. 
  4. Press Recognize to have Recog compare the new symbol with the models it has stored and return the probability that that the new symbol is a match for each of the elements in the program’s memory.
  5. If it identifies the symbol incorrectly, click Learn and tell it the correct answer.
  6. Repeat three times for each number. How well did it do? 
  7. Try entering a completely different symbol. What does the neural network do?

Activity 2: Supervised Learning—How’s Your Handwriting? (25 minutes)

Each student trains their model with their own handwriting. They then experiment with their handwriting on their neighbour’s system and see that it performs more poorly at first, due to differences in letter formation, then watch it learn.

A square drawn out and the drop down selected is square.
  1. Select New from the Network dropdown and Supervised from the Learning dropdown.
  2. Press Add to add a new character for the neural network to learn. Repeat for all the characters you would like the neural network to learn.
  3. Draw a letter, number or symbol with the mouse.
  4. Press Digitize to see how the software makes sense of what has been drawn and turns it into a series of squares.
  5. Select the correct symbol and press Learn.
  6. Repeat all chosen symbols three times, then test your partner’s computer.

Activity 3: Unsupervised Learning—Break the Code (25 minutes)

Teams of two face off. Which team can train their AI and break the code the fastest?

Each team is given a secret five-letter word.

  1. One person on each  team of two sets the program to unsupervised and submits all their symbols again. This time, the program will group them into types and create numbered categories. 
  2. Continue to train the machine to label the first letter of the secret word as “Type 1,” the second as “Type 2,” and so on. Train it as much as you want, but remember, you’re being timed!
  3. When you think the program has had sufficient training, it’s your partner’s turn to  decode your words. The team to decode all their partner’s words first is the winner.

Optional language integration: Train the learning program on other languages such as Inuktitut or French!


Conclusion

Class Discussion (10 minutes)

There are many applications that need to recognize characters—in fact, this ability was one of the very first use cases of machine learning. For example, this is essentially the type of algorithm Canada Post uses to scan and recognize addresses on envelopes. It’s also similar in concept to what Google uses to identify copyrighted music, or the way self-driving cars are trained to recognize stop signs. The current systems are just much more sophisticated.

  1. When Canada Post developed its system to scan handwritten as well as typed addresses on envelopes, what do you think the challenges might have been?  
  2. In the Recog game, you drew each character in a box. What advantages do you think the box might give a character-recognition algorithm?
  3. Can you think of ways a system like this might be used to improve peoples’ lives or make some tasks easier?
  4. Do you think the system would be more effective in reading cursive or printed handwriting? Do you think fonts impact the ease of recognition?
  5. Are there ways we might not want this type of machine learning to be used?

Resources

Additional Resources

  • Briana Brownell’s newly-released five-minute animated TED-Ed video “What Is Machine Learning?” explains the styles of machine learning

Social Media Resources

This lesson plan originally appeared in the fourth issue of Root & STEM, Pinnguaq’s free print and online STEAM resource supporting educators in teaching digital skills