Train a model and use it in Scratch
Use the free Machine Learning for Kids website to train a text model that spots kind and unkind messages, then use it in a Scratch project.
Let's build something real: a Scratch character that can tell kind words from unkind ones. In the tech course, you made games in Scratch. In Unit 2 of this course, you trained a model. Now let's put them together. You'll train a model to recognise kind and unkind messages, and then build a Scratch character that reacts to what you type.
New word: Machine Learning for Kids
We'll use a free website called Machine Learning for Kids, at machine learning for kids dot co dot U K. You can try it without an account, or your teacher can set up a class for you.
Train your model
Here's how. First, start a new project, and choose recognising text. Second, add two labels, kind, and unkind. Third, type at least five examples for each label. For example, you're a great friend goes in kind. More examples usually means a smarter model. Fourth, go to Learn and Test, and click train new machine learning model. And fifth, test it with sentences it has never seen, to check how well it learned. Here's what the training data might look like. Kind messages in one group, and unkind messages in the other. The model learns the patterns in the words.
Use it in Scratch
Now click Make, and choose Scratch. Your model appears as new blocks. Let's build the program. When green flag clicked, ask, say something to me, and wait. You type a message. Then, if the model recognises your answer as kind, the character says, thank you, that made me smile! Otherwise, it says, ouch, please be kind. Now test it. Try tricky messages, like, you're so bad at being mean. Does your model get confused? When it makes a mistake, add that kind of example to the right label, and train again. That's exactly how real A I teams improve their models.
Quick check
Quick check. Your model thinks, thanks for nothing, is kind. How can you improve it? Add examples like it to the unkind label, and train again. Better data makes a better model. Options: Add examples like it to the unkind label and train again; Delete the whole project; Change the label names; Make the font bigger.
Recap
Machine Learning for Kids is free. Make labels, add examples, train, and test. Then use your model as blocks in Scratch. Find the mistakes, add examples, and train again.
Key points
- Machine Learning for Kids (machinelearningforkids.co.uk) is a free website for training AI models and using them in Scratch.
- To train a text model: start a project, add labels (kind and unkind), type at least 5 examples for each, train it, then test it with new sentences.
- In Scratch, your model appears as new blocks, like "recognise text ... (label)", that you can use with if and else.
- When the model makes mistakes, add examples like them to the right label and train again.
Try it: Build a kindness checker
Do this on a computer or tablet at machinelearningforkids.co.uk. Under 13? Do it with a parent or teacher.