{"id":5181,"date":"2024-04-17T22:15:11","date_gmt":"2024-04-17T22:15:11","guid":{"rendered":"https:\/\/dalelane.co.uk\/blog\/?p=5181"},"modified":"2026-04-02T18:43:50","modified_gmt":"2026-04-02T18:43:50","slug":"shoot-the-bug-a-machine-learning-for-kids-worksheet","status":"publish","type":"post","link":"https:\/\/dalelane.co.uk\/blog\/?p=5181","title":{"rendered":"Shoot the bug (a Machine Learning for Kids worksheet)"},"content":{"rendered":"<p>Students are free to devise their own projects in <a href=\"https:\/\/machinelearningforkids.co.uk\">Machine Learning for Kids<\/a>, but I also write <a href=\"https:\/\/machinelearningforkids.co.uk\/worksheets\">project worksheets<\/a> to help inspire students and teachers. <\/p>\n<p>This evening, I\u2019ve written a new <a href=\"https:\/\/github.com\/IBM\/taxinomitis-docs\/blob\/master\/project-worksheets\/pdf\/worksheet-shootthebug.pdf\">worksheet based around regression models<\/a>. (I wrote about <a href=\"https:\/\/dalelane.co.uk\/blog\/?p=5060\">adding support for regression models<\/a> to the site a couple months ago). <\/p>\n<p>The premise for this project is sort of Space Invaders. Except with only a single Space Invader. And it&#8217;s a cute little bug. <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images.dalelane.co.uk\/2024-04-17-regression-bug\/bug01.gif\"\/><\/p>\n<p>The aim of the game is to shoot at the bug. <\/p>\n<p><!--more-->You can&#8217;t just aim directly at the bug, because it&#8217;s always moving. <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images.dalelane.co.uk\/2024-04-17-regression-bug\/bug02.gif\"\/><\/p>\n<p>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. <\/p>\n<p>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. <\/p>\n<p>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. <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images.dalelane.co.uk\/2024-04-17-regression-bug\/bug03.gif\"\/><\/p>\n<p>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.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images.dalelane.co.uk\/2024-04-17-regression-bug\/training.png\" style=\"max-width: 800px; width: 100%; border: thin black solid;\"\/><\/p>\n<p>You can use these examples to train a regression model, and then put that in charge of aiming the ball. <\/p>\n<p><iframe loading=\"lazy\" width=\"450\" height=\"250\" style=\"border: thin black solid;\"  src=\"https:\/\/www.youtube.com\/embed\/61ErSoKc2kM?si=kBJ3cU1KLfKYfF41&amp;start=50\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>I&#8217;ve written up step-by-step instructions for how to create this and added it to <a href=\"https:\/\/machinelearningforkids.co.uk\/worksheets\">machinelearningforkids.co.uk\/worksheets<\/a>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images.dalelane.co.uk\/2024-04-17-regression-bug\/worksheet.png\"\/><\/p>\n<p>This is only the second worksheet I&#8217;ve written based on regression. The first was similar &#8211; about <a href=\"https:\/\/dalelane.co.uk\/blog\/?p=5060\">predicting where a projectile will land<\/a>. I&#8217;ll try and come up with something a bit different for the next one!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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\u2019ve 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[587],"class_list":["post-5181","post","type-post","status-publish","format-standard","hentry","category-tech","tag-mlforkids-tech"],"_links":{"self":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5181","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5181"}],"version-history":[{"count":2,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5181\/revisions"}],"predecessor-version":[{"id":5986,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5181\/revisions\/5986"}],"wp:attachment":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}