Explaining regression in Scratch

In this post, I want to share a preview of a new feature I’m adding to Machine Learning for Kids, to ask for feedback and ideas for projects that it could be used to make.

I’ll start by contrasting this new feature with what I’ve done with Machine Learning for Kids before, then I’ll share screenshots of the new feature, and finally I’ve got a ten-minute video showing the sort of school lesson that I think it could be used for.

Machine Learning for Kids so far

Until now, most of the machine learning models I’ve enabled in Machine Learning for Kids have been classification models.

Students collect examples of different types of things, and create a machine learning model that can recognize what type a new thing is.

Classifiers are simple to explain, easy to train, and enable a variety of interesting projects.

Collect examples of headlines from different newspapers. Give the model a new headline, and it can recognize which newspaper the headline is from.

Collect examples of statistics of Pokemon of different types. Give the model the stats for a new Pokemon, and it can recognize what type the Pokemon is.

Collect examples of pictures from a traffic camera, sorted into the number of passengers that can be seen. Give the model a picture of a new car, and it can recognize whether the car belongs in the car pool lane.

Collect examples of recordings of different types of sounds, sorted into different commands. Give the model a new sound recording, and it can recognize which command it has heard.

Classification models.

I’ve seen hundreds of projects created using this simple pattern. The input is collection of things, sorted into buckets. The output is the name of the bucket that a new thing should go into.

Regression models can enable different project types

With regression models, you still collect training examples, but instead of sorting them into groups, each examples has one or more numerical output values.

When you give the model a new example, instead of recognizing what bucket it should go into, the model predicts what the output value(s) should be.

Example of a regression project

My first test/demo of the regression model support in action is predicting where a bouncing ball will first hit the ground. The training examples are the starting location, speed, and direction.

The model predicts the x coordinate for where the ball will first hit the ground – so you can use that to try and catch the ball before it hits the ground.

This is a nice example of the sort of project that you couldn’t create using classification models, so I think it’s a nice extension to Machine Learning for Kids.

Demo of the new feature in action


youtu.be/SiUURaOQcdk

Here is a ten-minute run-through of what a regression lesson could look like, using the bouncing ball project idea.

What do you think?

Can you think of any other project ideas that regression models could enable?

Can you think of a better way to present or explain it to children?

Please let me know!

Tags:

One Response to “Explaining regression in Scratch”

  1. EJ says:

    Really cool, we missed this kind of AI algorithms in the worksheets, so I endorse the importance of this feature. REally looking forward to it to use these in the classroom. If any support necessary please contact me.

Leave a Reply