B2 · How Artificial Intelligence Works: Data and Learning

Examples, Labels and Features

In machine learning, an example is one item the model learns from. Its label is the correct answer, such as 'apple' or 'orange'. Its features are the measurable clues the model uses to decide, such as colour, weight or how smooth the skin is.

10 min Beginner Jump to the activity

What you need: Nothing. This page starts from the beginning, with no programming and no formulas.

Definition

What clues tell an apple from an orange, even with your eyes closed?

In machine learning, an example is one item the model learns from. Its label is the correct answer, such as 'apple' or 'orange'. Its features are the measurable clues the model uses to decide, such as colour, weight or how smooth the skin is.

In simple words

Think of a table. Each row is one fruit (an example). The last column says what it really is (the label). The other columns are clues: colour, weight, skin (features). Good features make the job easy: skin texture separates apples from oranges well. Bad features don't help: both can weigh the same.

Why it matters

Choosing good features is one of the most important decisions in building a model. If the clues don't separate the answers, no amount of training will help.

How it works

ColourWeight (g)SkinLabel
Red150SmoothApple
Orange160BumpyOrange
Green140SmoothApple
Orange150BumpyOrange

Here weight is a poor feature, because apples and oranges weigh about the same. Skin is an excellent feature: smooth means apple, bumpy means orange.

Try it yourself

Pull one example apart

An apple and an orange: what does the model actually see?

Label or feature?

A model predicts whether a student will enjoy a book. Is each item a feature or the label?

  • Number of pages

  • Type of book: adventure, mystery, science

  • Did the student enjoy it? Yes or no

  • Has pictures or not

Choose the clues that separate apples from oranges

Would each feature help a model tell them apart?

  • Skin texture: smooth or bumpy

  • Price

  • Smell

  • The day it was bought

  • Weight

Common mistakes

  • Mixing up the label and the features. The label is the answer; features are the clues.
  • Using features that have nothing to do with the answer.
  • Using a feature that secretly contains the answer, which makes the model look better than it is.

Check yourself

Question 1

1. In a spam filter, 'spam or not spam' is the…

Question 2

2. Which is a good feature for telling cats from dogs?

Question 3

3. What is one row in a table of examples?

Summary

  • An example is one item; its label is the right answer.
  • Features are measurable clues the model uses.
  • Good features separate the answers; poor ones don't help.

Finished reading?

Sources: Google Machine Learning Crash Course