Hoops (a Machine Learning for Kids worksheet)

Machine Learning for Kids is intended to be an open creative sandbox to let students invent their own AI-powered projects. But in order to enable that, I create more prescriptive project worksheets to inspire and show what is possible.

I’ve just written another worksheet based around regression models – a model type that I added support for in February.

This project is based on shooting basketballs.

You could try to calculate the power and direction to use to fire the ball. In this project, students train a regression model to predict the values to use, based on the starting location of the ball.

To do this, students play the game for themselves. It’s harder than it looks… but you can reset and tweak the power and direction values until you get it in the hoop.


youtu.be/OrKoAP345oc

Every time you score, these values are added into the training data for your project:

  • starting location of the ball, as x,y coordinates
  • power value used to launch the ball
  • direction the ball was fired in

These examples can be used to train a custom machine learning model that can predict the power and direction to use.

This model can be added to the Scratch project.

Even with a small number of training examples, the model gets surprisingly good at scoring hoops.


youtu.be/KS89KD91Vzs

I’ve written up step-by-step instructions for how to create this and added it to machinelearningforkids.co.uk/worksheets.

What is different about this project?

My goal for this project was to show an example of a regression model with more than one output variable.

Until now, the other regression projects have all predicted a single value, so I wanted an example project that shows you can have multiple outputs. It’s a very neat difference to the classification models that are behind most of the project worksheets.

But maybe it’s not that different

I’m struggling to come up with something original here!

The regression worksheets I’ve got so far are:

Catch a ball, by predicting where it will land

Shoot the bug, by predicting where the ball will go

If I was feeling defensive, I’d argue that they are all using machine learning in a different way. For example, the first project is based predicting a parabola that takes bounces off the wall into account, while the second is a straight shot at a moving target. But. They’re still all based around projectiles.

I need a new idea for a regression project that isn’t based on a moving ball!

Tags:

Leave a Reply