How can a computer learn to classify objects from examples?
Unit 3, Module 3.2
1
Pastas (cut out)
2
Corkscrew
Rigatoni
Ravioli
cascatelli
Tortellini
Penne
Macaroni
Fusilli
farfalle
Zitti
Training Set
Try It #1: Pasta Land - Creating a Pasta Classifier
Setup: (a) Get a big sheet of poster paper for drawing your tree; (b) cut out pictures of pastas (or use real pastas provided by your teacher) that you can move around the nodes of your tree.
Step 1: Propose a bunch of features to distinguish between the pasta types
Step 2: Pick a feature that will split the pastas into two roughly equal groups
Step 3: Take the features, build the decision tree.
Step 4: Test this out and update the features and the tree
Step 5: Convert the tree into a table.
3
4
Step 1: �List all the features you think may be useful to distinguish the pastas.
��
Step 2: Create a root node and place all the pastas there.��
A feature is a property of a thing we are trying to describe.
Step 3: Pick a feature from the list that splits the pasta examples in the current node roughly in half.��
5
Yes
No
Step 4: Create two children of the current node and split its pastas between them based on the feature.
6
Is it long?
Yes
No
Yes
No
Step 4: Create two children of the current node and split its pastas between them based on the feature.
Feature Vector Description of Pasta
Add more columns to fit all your features & more rows to fit all your pastas
7
Pasta | | | |
Spaghetti | | | |
Lasagne | | | |
Rigatoni | | | |
Ravioli | | | |
| | | |
| | | |
| | | |
| | | |
| | | |
Use this test set to see how good your features are at classifying a new set of pastas
8
Mezzaluna
Mafaldine
Calamarata
Penne
Ravioli
Shell
Or Pick Your Own Set of Pastas
https://en.wikipedia.org/wiki/List_of_pasta
https://www.delish.com/uk/food-news/�g31017969/pasta-shapes/
9
Feature Vector Description of Pasta
10
Pasta | | | |
Spaghetti | | | |
Lasagne | | | |
Rigatoni | | | |
Ravioli | | | |
| | | |
| | | |
| | | |
| | | |
| | | |
Test Set - Data Collection Sheet
11
Pasta | Correctly classified | Incorrectly classified |
Spaghetti | | |
Lasagne | | |
Rigatoni | | |
Ravioli | | |
| | |
| | |
| | |
| | |
| | |
Reflection
How well did your pasta classifier do on this new test set? What pastas did it classify incorrectly?
Were your features flexible enough to allow you to classify new pasta? Why or why not?
How would you change your features to allow them to better classify a wider range of pastas?
12
Takeaways
13
If your data is in a feature vector table like this then you don’t have to build the tree yourself
People don’t usually build decision trees by hand because for realistic tasks it can be hard.
For practical problems, people build a table that may have thousands of rows (examples) and dozens of columns (features). Each example is labeled with the correct decision (i.e., the class it belongs to).
Then they use a machine learning algorithm to create the decision tree.
14
Machine Learning is a process for constructing a reasoner (such as a decision tree classifier) using training data and a learning algorithm.
Pasta Land vs Mini-Akinator
Pastaland is a simulation of a machine learning algorithm
Take away - The new way we build the tree in Pasta Land is what a machine learning algorithm will do for you.
Mini-Akinator - simulation of creating and growing a decision tree
Take away - We learned how to create and grow a decision tree and get some insight into how Akinator works.
15
Let’s look at some examples from the real-world
16
Try It #2: Think of a real-world example
Step 1: Pick a situation in the real world where computers might make decisions
Step 2: Think about the attributes that would contribute to making good decisions ��Step 3: Reflection: Think about how your life is being affected by classifier systems (automated decision making).
Examples
17
Computers don’t learn the way people do.
18
How do people learn?
19
Discussion
Ways people learn
20
Note: None of these are things that computers currently do well.
Ways Computers Learn
21