Celebrity Heads
Just add Computer Science!
AM I HUMAN?
NO
What do Decision trees do?
We can use them for classifying things!
You just need to ask a series of Yes/No questions to narrow down the possible answers.
A decision tree where every question has only two options (like yes/no), is called a binary tree.
What do Decision trees do?
We can use them for classifying things!
You just need to ask a series of Yes/No questions to narrow down the possible answers.
A decision tree where every question has only two options (like yes/no), is called a binary tree.
What questions do you need to ask to figure out
What animal am I thinking of?
as quickly as possible?
What animal am I thinking of?
Does it have hair/fur?
Could you keep it as a pet?
Does it have feathers?
YES
NO
YES
NO
YES
NO
Is it a cat?
YES
NO
Is it a Giraffe ?
YES
NO
Is it a farm animal ?
YES
NO
Does it have legs ?
YES
NO
Is it a reptile?
YES
NO
What animal am I thinking of?
Does it have feathers?
NO
YES
YES
NO
Is it some sort of cat?
YES
NO
Is it a farm animal ?
NO
YES
Does it have legs ?
YES
NO
Is it an amphibian?
YES
Is it an reptile?
YES
NO
Is it tall?
YES
Should you keep it as a pet?
YES
NO
So how do we build a good tree?
Does it have hair/fur?
Could you keep it as a pet?
Does it have feathers?
YES
NO
YES
NO
YES
NO
Is it a cat?
YES
NO
Is it a Giraffe ?
YES
NO
Is it a farm animal ?
YES
NO
Does it have legs ?
YES
NO
Is it a reptile?
YES
NO
So how do we build a good tree??
Does it have hair/fur?
YES
NO
YES
Does it have legs ?
NO
Ask good questions, at the right time to halve the group
So how do we build a good tree??
Does it have hair/fur?
YES
NO
Repeat for each half!
Now you’ve ruled some out maybe some different questions are useful.
Could you keep it as a pet?
YES
NO
So how do we build a good tree??
Does it have hair/fur?
YES
NO
Could you keep it as a pet?
YES
NO
Does it have feathers?
YES
NO
What are we going to do?
How do we do it?
Remember - make a balanced tree!
How to play?
When you’ve finished building your Celebrity Heads algorithm decision tree …
You can call a tutor over to play your game!
Let’s do it
Ask a tutor if you get stuck!