Introducing Machine Learning to kids

Today, I was helping out with a Computing summer school for teachers in London.

As part of this, I gave a presentation about machine learning to a room full of school teachers – about what it is, why I think we should be introducing it in the classroom, and how I think we could do that.

My slides are on Slideshare, but they might not make a lot of sense by themselves, so I’ll jot down here roughly what I said.

slide 1

This morning I want to talk to you about machine learning. In particular, I want to talk with you about machine learning in the context of education and how it could be introduced in the classroom.

slide 2

I’m going to try and cover three main points.

Firstly, a quick level set on what I mean by machine learning.
Then I’d like to talk about why I believe it’s important that we do this.
Finally, I want to talk about the practicalities of how we could effectively introduce machine learning in an accessible way.

So, let’s start with the what.

(Machine learning is a broad umbrella term that covers a variety of techniques and technologies. There’s no way I’m going to do this justice, so apologies in advance for the horrendous over-simplifying that is coming!)

slide 3

This is Scratch.

I know you’re all familiar with it, and we’ve talked about it a few times today already.

Scratch aims to explain the idea behind programming. It teaches that programming is about taking a complex task that you want a computer to do, and describing that as a series of specific steps.

The point of choosing from a set of simple blocks and snapping them together is to give kids an accessible visual metaphor for the concept of programming.

slide 4

Machine Learning is a bit different.

With machine learning, to get the computer to perform a complex task, you collect a set of examples of that task being done.

The computer learns how to do that task from the examples that it is given.

slide 5

For example, say that I wanted to teach you how to kick a ball.

In a traditional programming sort of approach, I’d give you a series of detailed instructions.

I’d tell you how far to lift your foot back. I’d tell you what angle to put your ankle at. I’d tell you how much to bend your knee. How fast to move your leg.

I’d tell you exactly what I wanted you to do, how I wanted you to do it, how fast I wanted you to do it, and the order that you should do things in.

slide 6

In a machine learning sort of approach, I’d show you lots of examples of kicking a ball.

Maybe examples of different people kicking a ball.
Maybe even kicking different types of ball.

Instead of telling you what to do, I’d get you to learn from the collected examples of people who are already able to kick a ball.

slide 7

A quick aside.

We use a lot of metaphors in this field. We use words like learn, train, and teach.

But these aren’t machines with emotions or consciousness. And they don’t learn or think like we do.

What I’m saying is, it’s great to use the metaphors while they are helpful – but it’s not exactly the same, and it’s important not to get too carried away.

slide 8

With that in mind, lets try a more technical example.

Imagine you wanted to make your own email spam filter for school.

You decide to make it using programming. You break down recognising spam emails into a series of steps that a computer can follow – what we’d describe as a rules-based approach.

Let’s say that you get an email like this with a Nigerian scam.

So you add a rule to your program that says any email that mentions Nigeria is spam.

slide 9

But that ends up binning your colleague’s email about a possible Geography project on Nigeria.

So you go back to your rules and change it so that only emails that mention Nigeria and money are spam.

Emails from your colleagues are safe!

slide 10

But now that bins emails from your mobile phone network about how much calls cost while abroad. Which coming up to the summer would’ve been really useful!

The point is, trying to do this by manually identifying the right set of rules is difficult.

And slow.

And painful.

And as the set of rules get bigger and bigger and bigger over time, it becomes really difficult to manage. New rules you add will contradict or break rules that you added a month ago.

slide 11

You start again, and this time you use machine learning.

You collect a set of examples of the sort of emails that you get.

You read through them, and sort them into two piles.

slide 12

Spam emails in one pile. Legitimate not-spam emails in the other.

You use these examples to train the computer to be able to recognise what a spam email looks like.

That’s not to say that the computer might not make the same mistakes I showed before.

If every spam email in the spam pile was a Nigerian scam email, and there were no emails in the not-spam pile that included a reference to Nigeria, then there is a reasonable chance that the computer could learn that references to Nigeria mean an email is spam.

Based on the experiences that it would have had to learn from, why wouldn’t it?

But if you included a variety of types of spam, including some that don’t mention Nigeria, in the spam pile…
And if you included a variety of not-spam emails, including a few that mention Nigeria, then…

Then the computer would stand a better chance of learning how to do this well.

slide 13

This is becoming ubiquitous. Machine learning is all around us. You use machine learning systems every day.

Spam filters are a good example.

So are assistants like Siri, Google Now and Alexa.

Systems that translate one language to another – trained on examples of documents that have been manually translated.

The auto-suggest on my phone keyboard, that suggests what word I might want to write next – trained on examples of what I’ve typed before.

Credit card fraud detection – trained on my buying patterns to recognise a purchase that might not actually be me.

And many many many more.

And this is just in the consumer space.

slide 14

In the business space, machine learning is everywhere.

Almost all projects we do for clients today will include some element of machine learning somewhere.

This isn’t the exclusive domain of PhD’s in white coats any more – this technology is accessible to anyone with some basic technical skills.
If you can build an iPhone app, you can use machine learning.

And it is increasingly becoming the most effective and most efficient way to do a wider variety of tasks.

slide 15

So… that’s the WHAT out of the way.

But why should we introduce any of this stuff to kids?

slide 16

Firstly, it’s fun.

I’m not sure how compelling an argument that is, but it really should be.

It is fun to train a computer, to see how it learns, to try and figure out what it’s getting wrong and how to teach it to improve, and see it change.

But assuming that this isn’t enough of a reason, I want to try and break this down.

The kids we teach today will go on to take a wide variety of roles – and I think there are benefits to introducing all of them to machine learning now, not just the obvious ones like developers or techies.

Let me give you a few examples.

slide 17

Some of them will go on to become the inventors of the next generation of technology.

They will invent the next type of machine learning systems that can solve the bigger problems that we can’t even approach today.

We need them to keep technology moving forwards, and maybe introducing machine learning to them today, letting them play with it, experience it, understand it – maybe that is what will fire their imagination and kick off a lifetime of invention and creativity.

slide 18

Some of them will go on to become coders, developers, makers and builders.

I mentioned before how this stuff is becoming easier and easier to use. That will surely increase over time.

The creators of tomorrows apps will need to know how to apply machine learning, so maybe introducing it to them today and thinking about what it makes possible is what gets them started on building apps and systems that will make all our lives easier.

slide 19

Problem Solvers.

Coding isn’t the only way to use machine learning.

It’s not just developers who are going to use this.

Some of the tools being built now, including a couple of IBM like SPSS and Watson Analytics, look more like spreadsheets. But spreadsheets that learn from the patterns in the data you enter.

This isn’t something I think we need to teach only to the super-techie-code-monkeys of the future. It’s about introducing them to a kind of tool that they’ll have in their future toolkit that they’ll need to use to solve the problems of tomorrow.

And, more importantly, teaching them to think about solving problems in this way.

slide 20

It’s not just about people who will invent or build with the technology though.

Some of them will go onto become policy makers.

Some of these will be law makers – and as machine learning increasingly touches all of our lives, we will need our law makers to understand how this technology works and what it is capable of and what the implications are. They need to understand this to make sure appropriate protections can be put in place while supporting innovation and development.

But it’s not just law makers. Policy makers include hospital boards, company directors, charity trustees, school governors, and many many more.

As machine learning becomes a tool we use for more and more things in every day life, we need the people who are making the decisions to understand how it can and should be used.

slide 21

And this affects everyone who will make up the public of tomorrow. The next generation of our community.

It’s important that we have a greater level of understanding of machine learning in the public – exactly because it is all around us. It affects us all, and we all need to at least be aware of this.

slide 22

Partly this is just about recognising it.

I loved when a student in one of the school groups I was working with asked if when they rated something on Netflix whether they were training a machine learning system to be able to recommend programmes to them. They didn’t use exactly those words – I forget how she asked – but that was essentially the gist. They’d started to recognise that this stuff is all around them.

That was awesome.

slide 23

Partly it’s about informing public debate.

This happened off a couple of years ago. A machine-learning based system from Google, that automatically tags your photos for you based on what it recognises in the photo, tagged a couple of people as gorillas.

I’m a little wary of singling out Google as an example, because let’s be clear, we’ve all made this sort of mistake and more than once.

slide 24

But this went viral.

There was an angry reaction across social media, and the next thing you know Google are being acused of being racist.

This was really unfortunate for lots of reasons.

Firstly, the anger directed at the team and company responsible for the tool was unfair. There were a lot of fairly ridiculous accusations that they had programmed the tool to do this. There were accusations that they had told the tool to call black people gorillas.

I don’t know anyone who works on Google Photos, but I’m fairly comfortable assuming that they’re probably not racist. They probably don’t think that black people are gorillas.

If there was a greater level of understanding of machine learning in the general public, I don’t think the reaction would’ve been so angry.

But more than that, the angry reaction drowned out the potential for a sensible rational debate about what this showed.

Because while I don’t think they were racist, I do think that there is a valid debate to be had about how they trained their systems.

For example, if all or even most of the example photos they used to train their system to recognise faces were white, then it’s possible that the system wouldn’t be as effective at recognising people with different coloured skin. If algorithms are being written by white men, using features selected by white men, with a set of examples collected by white men… then maybe this sort of thing is the result.

Now I’ve not worked on this system. This is pure conjecture. I’m absolutely saying “maybe” here.

But a debate on how the behaviour of our machine learning systems reflects the culture and makeup of the people who’ve created and trained them – that would’ve been a worthwhile debate.

Screaming “racist” at them – that wasn’t.

But we don’t have enough of a basic literacy in the general population to enable that kind of debate.

slide 25

And that’s a relatively trivial example.

There are more important debates that we need to be having.

Self-driving cars. Are we happy for machine learning systems to drive our cars for us?

What are the value judgments that will be instilled in these systems by the way that they are trained?

There are a load of ethics issues surrounding this that are very hard to engage people in properly.

slide 26

Or healthcare.

Increasingly, machine learning is used in the diagnosis and treatment of major illnesses. We’ve spent years working on machine learning systems for oncologists – for cancer doctors.

We need to enable an informed public debate on this. Partly that’s about educating the future law and policy makers as I said a few slides earlier.

But it’s also about enabling the wider public debate.

slide 27

For example, when the system is trained to identify appropriate treatments, what if the examples are selected by a pharmaceutical manufacturer?

What if they put their own drugs in the set of examples of good treatments to recommend, and their competitors drugs in the set of examples of ineffective treatments.

Machine Learning isn’t magic. It is not a definitive source of truth.

These systems will reflect the biases of the people who build and train them.

We should be demanding transparency. We should want the systems that our doctors use to make it obvious why they’ve chosen one treatment over another, and to be able to see how they’ve been trained.

But we don’t have the basic literacy in the general population about the implications of this technology to be able to demand this effectively.

slide 28

It’s important that we introduce machine learning to kids. Not just the ones who will invent it or build with it (although that is super important). But the ones who will use it and be affected by it as well. And that’s all of them.

Now for the fun bit – how we could actually do this.

I’ll run through a few examples of the sorts of projects that we’ve been doing with some of the schools near to our lab – projects that I’d like to make more widely available and the sorts of things that I think all of your schools could be doing.

slide 29

The best way for kids to learn about machine learning is for them to get hands-on, first-hand experiences.

If they can train a computer to do something, they’ll get it.

If they see what makes it learn more effectively, or what sort of training makes it get everything wrong – they’ll get it.

If presented in the right way, the basic principles can be totally accessible.

slide 30

We need some equivalent to Scratch. An easy to use tool, that provides a visual metaphor for the concept of machine learning.

Something that lets them set up a few buckets, and then collect examples of text or images or numbers – to train a computer to be able to recognise them.

I ran through a live demo of this project – I gave a super-fast demo of training a sentiment analysis text-classifier by collecting examples of “kind” messages and “mean” messages.

slide 31

I used that to make a game in Scratch where you send a message to the character, who reacts based on whether you say something kind (and they smile) or mean (and they cry).

We can use the training from inside Scratch – so we don’t have to teach the kids a whole new way to use or apply the machine learning models that they create. They can build on what they already know – so this becomes an incremental next step on top of how they already learn about coding.

slide 32

Or this project – where they can make a Harry Potter Sorting Hat in Scratch.

I ran through a demo of this project – collecting examples of quotes from different characters in Harry Potter books, sorting them by school House.

And then making a Sorting Hat character in Scratch that tells you what House you should be in.

It put me in Hufflepuff. Is that good?

slide 33

Games are a great way to introduce machine learning. The kids can train the computer to be able to do a job they know very well – playing a game – that would be difficult to do using the rules-based approach to coding that they normally use.

I showed a demo of the Guess Who project that I did last year – training a system to recognise questions like “Are they wearing a hat?” and to be able to recognise characteristics in photos of faces well enough to be able to answer them.

A video similar to what I showed is on YouTube.

slide 34

Building chat bots are another great project that we’ve run with schools.

It’s also a good way to make this part of an existing project or curriculum.

If kids are already researching a particular topic, instead of preparing a presentation about it, another way to deliver that research can be to train a bot to be able to answer questions about it.

I gave a live demo of the chat bot that Faith trained to answer questions about owls – it’s here if you want to try. Fortunately, it gave the right answers to everything the teachers asked!

For example, if the kids are doing a history project on Vikings, they could train a bot to be able to answer questions about what it was like to live as a Viking. You could ask it what sort of food they ate, or what they wore. It’s still a history project, but they’re learning about how to apply machine learning at the same time.

slide 35

This is a great example. It wasn’t actually trained by kids (as far as I know) but I love it so I want to mention it anyway.

This is a chatbot from National Geographic that answers questions as if it was a Tyrannosaurus Rex. And kids can ask questions about how they lived. It’s a great way of making the information interactive.

A school that I’m working with now are using this sort of thing to make an interactive school prospectus. They’re training a chat bot to answer questions about their school.

slide 36

It’s not all about text though.

We can do this with numbers as well. This is a project that we did in a schools event called ThinkIT – where kids trained the computer how to play the card game Top Trumps.

This is a project I’ve written about before. The game is still up and running if you want to give it a try!

slide 37

Pictures are another fun way to make machine learning come to life.

This project was about training a computer to play rock, paper, scissors. They had to use a webcam to take pictures of their hands making the shapes of rock, paper, and scissors. Once they’d trained a machine learning model to be able to recognise the hand shapes, they could then play a game against it using the webcam.

I’ve written about this project before. The game is still available if you want to give it a try.

What has been great about all of these projects isn’t the final result, but the way that the kids got there.

For example, with this project, one of the times I ran it I had this super-keen kid. I’d told them all how more training was better, so he held his hand up to the webcam in a “rock” fist shape, and quickly hammered the “take-photo” button 15 times in about a second. And then the same for “paper” and “scissors”.

They trained a model, and were super pleased to have been the first to finish and so quickly.

But their model was pretty terrible. It got almost everything wrong.

They’d collected 15 almost-identical examples of each shape. The lack of variety of the examples they’d collected was a problem.

So I suggested that they try again, but this time moving their hand into a different position in between each time they click “take-photo”. They collected the same number of examples as before, but this time a variety of photos of hands at different angles.

This time it worked much much better.

There was an ah-ha penny-dropping moment for that kid that I absolutely loved.

I did talk about how and why the variety of different training examples makes the system learn better how to recognise what a particular hand-shape looks like, but to be honest – it was seeing it for himself that made it make sense.

And that’s what I’ve tried to shoot for in all of the projects that I’ve run.

slide 38

so, to recap – I’ve tried to introduce machine learning as a type of approach to working with computers where you use examples to train a computer to be able to do something.

I’ve talked about why I think it’s important that we introduce this to kids in the classroom. Not just the geeky ones. Not just the ones who enjoy coding. But all of them, at least to give them enough basic literacy to be able to understand and appreciate how the world around them works.

And I’ve tried to show you that this is totally do-able. If it’s presented in the right way, I’m convinced that kids – even at primary school age – are able to understand the basic principles and use this tech to build some really fun projects.

slide 39

I’d love to work with you all on this to try and take the ideas further. I’m already working with a few schools on this, but I’d love to add more schools to this, so if you’d like to get involved, please do get in touch.

Thanks very much for listening.

Tags: , ,

3 Responses to “Introducing Machine Learning to kids”

  1. Vivek Karimbil says:

    Hi Dale,
    I recently conducted a training on an introduction to IoT at my daughters school for 7th and 8th class students, which went off well, and now they are asking if I could do the same with machine learning. I have no background on the topic, so the pointers from your article were amazing. I am still trying to figure out what software to use for this, and what exercises I can introduce, and this article pointed out some awesome ideas. Thanks so much.


  2. Mete Varas says:

    Hi Dale,

    First, I’d like to congradulate & thank you for taking time to create such a fantastic web site along with all documentation. It’s just great.

    My connection with the subject is besides being a father of 13yo son, AI is the hot topic on our company -not surprisingly I guess-. (I’m a serial entrepreneur/mentor/advisor/executive/friend…)

    I wonder if we can use your web site and games in Istanbul (& in Dubai). My friend Zeynep owns MakerKids in Istanbul. She would love to include ML on her courses. In fact, She would love to meet you too.

    Best regards,

    Mete Varas

  3. Estrella Utrera Montes says:

    Very inspiring! I loved the presentation. The way you explain the concepts is such that there is no need to have a background on the subject to understand. Thank you for sharing your knowledge and overall, thank you for believing that kids can learn and giving the tools to achieve that goal.