Shoot the bug (a Machine Learning for Kids worksheet)

Students are free to devise their own projects in Machine Learning for Kids, but I also write project worksheets to help inspire students and teachers.

This evening, I’ve written a new worksheet based around regression models. (I wrote about adding support for regression models to the site a couple months ago).

The premise for this project is sort of Space Invaders. Except with only a single Space Invader. And it’s a cute little bug.

The aim of the game is to shoot at the bug.

You can’t just aim directly at the bug, because it’s always moving.

You need to shoot in front of it if you want to be able to hit it. And to make this a bit more challenging, the bug will start in a different position every time, and move at a different speed.

You could try to calculate the direction to fire the ball at, but for this project, students train a regression model to predict the angle to aim the ball.

A simple way to do this is to repeatedly fire the ball in random directions. With enough attempts, you will get lucky and hit the bug sometimes.

You can collect all of these times you got lucky. When the ball hits the bug, you record where the bug was, and the speed and direction it was moving, at the moment that the ball was fired.

You can use these examples to train a regression model, and then put that in charge of aiming the ball.

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

This is only the second worksheet I’ve written based on regression. The first was similar – about predicting where a projectile will land. I’ll try and come up with something a bit different for the next one!

Tags:

Leave a Reply