Full teaching narration is free with Private Starter.Create free account
Back to curriculum
Computer ScienceGrade 1· U.S. National — Common Core & NGSS
Aligned to:U.S. educational frameworks

Yes-or-No Animal Classifier

Students use observable traits and yes-or-no questions to classify animal picture data into categories and create a simple branching decision tree.

Yes-or-No Animal Classifier

Illustrations are auto-generated and may be placeholders. They can be refreshed to match the narration.

Full teaching narration is included free with a Private Starter account.Create free account

Meet the Animal Data

Animal pictures can be data. Data are pieces of information we collect and study. Imagine six picture cards showing a duck, an eagle, a cat, a dog, a frog, and a goldfish. Look closely at what each picture shows. You can organize the cards by counting legs. The duck and eagle each have two legs. The cat, dog, and frog each have four legs. The goldfish has no legs. This makes three categories: zero legs, two legs, and four legs. Count the cards in each category and compare the totals. Clear photographs, a trusted animal book, or information from your teacher can be helpful sources when a picture does not show a trait clearly.

Six animal picture cards are sorted into columns for zero, two, and four legs.
Six animal picture cards are sorted into columns for zero, two, and four legs.Source: Illustrated for this lesson

Find Observable Traits

An observable trait is a feature you can notice by looking carefully. You might see feathers, fur, fins, a tail, webbed feet, or a certain number of legs. Use only what the picture clearly shows. Do not guess what an animal likes or how it feels. For example, a duck picture shows feathers, two legs, a bill, and webbed feet. A kitten and an adult cat may both have fur, four legs, pointed ears, and a tail. These shared traits show how the young cat is similar to its parent. The kitten may be smaller or have different markings, so it is not exactly the same. Record one or two clear traits for each animal card before sorting the data.

A duck and a kitten with an adult cat have their clearly visible body traits marked.
A duck and a kitten with an adult cat have their clearly visible body traits marked.Source: Illustrated for this lesson

Ask Yes-or-No Questions

A classifier uses questions to decide where data belong. A useful classifier question must have only two answers: yes or no. Ask about one observable trait at a time. For example, ask, “Does the animal have feathers?” The duck and eagle go in the yes group. The cat, dog, frog, and goldfish go in the no group. A question such as “What animal is it?” is not a yes-or-no question. A question such as “Is it cute?” is also not useful because people may disagree. Good questions use traits that can be checked in the pictures. After asking a question, count the cards in each group. Check a clear photograph or trusted animal book if you need more evidence.

The six animal cards split into yes and no groups after one question about feathers.
The six animal cards split into yes and no groups after one question about feathers.Source: Illustrated for this lesson

Build a Branching Classifier

A branching classifier is a path of yes-or-no questions. It is also called a decision tree. Begin with all six cards at the top. First ask, “Does it have feathers?” On the yes branch, ask, “Does it have webbed feet?” A yes leads to the duck, and a no leads to the eagle. On the first no branch, ask, “Does it have fur?” A yes group contains the cat and dog, so ask another visible-trait question to separate those pictured animals. A no group contains the frog and goldfish. Ask, “Does it have fins?” A yes leads to the goldfish, and a no leads to the frog. Follow one branch at every question until the card reaches a category.

A decision tree sends all six animal cards through branches about visible traits to separate endings.
A decision tree sends all six animal cards through branches about visible traits to separate endings.Source: Illustrated for this lesson

Test and Improve the Rules

Test a classifier by giving it an animal picture that was not used to build it. Follow every rule exactly. Suppose you add a penguin card. The penguin has feathers and webbed feet, so the first classifier may incorrectly send it to the duck category. This test shows that the rules need improvement. Add a new question after the webbed-feet branch: “Does it have a wide, flat bill?” The pictured duck goes to yes, while the penguin goes to no. Use a trusted animal book, a clear photograph, or your teacher to check each trait. Then test all the cards again. A good classifier sorts the picture data correctly. If two different animals still reach the same ending, add another clear yes-or-no question.

A penguin exposes a mistake in the first tree, so a new bill question separates it from the duck.
A penguin exposes a mistake in the first tree, so a new bill question separates it from the duck.Source: Illustrated for this lesson