Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Online Courses / University Track / Learning from Data

Module 1 · Lesson 2 · Core

Features, labels and the data table

Describe each example by its features and label, and read the table a model learns from.

  • 50 minutes
  • Serves O1
  • Assumes M1.L1

Phase 1: Prepare

Step 1 Warm-up recall

From M1.L1: define supervised learning in one sentence.

Private: nothing you type here is sent or stored.

Step 2 Learning goal

By the end of this lesson you can:

  • identify features and the label in a table (Foundation);
  • explain why the label is hidden at prediction time (Core);
  • say what makes a feature useful (Core).

Phase 2: Teach

Step 3 A familiar example

An estate agent estimates a home’s value from its size and number of bedrooms. Size and bedrooms are what she sees; the sale price is the answer she wants to predict.

Step 4 Clear explanation

Each row of the table is an example. The columns that describe it, and that will be known when we need a prediction, are its features. The column we want to predict is the label (also called the target). In the invented housing table below, area and bedrooms are features, and sale price is the label.

HomeArea (m²) — featureBedrooms — featureSale price (£ thousands) — label
A602200
B753240
C903280
D501170

To train a model we need rows where the label is known. To use it, we give it only the features of a new home and ask it to estimate the label. A feature is useful if it carries information about the label and is available at the time of prediction. The sale price itself cannot be a feature for predicting the sale price, because it would not be known in advance. Mistakes of this kind, called leakage, are revisited in Module 7.

Notice also that features must be recorded the same way for every example. A column in square metres for some homes and square feet for others breaks the table. This links to the tidy-table ideas in the entry on regression analysis.

Step 5 Worked example (4 marks)

A hospital wants to predict whether a patient will return within 30 days. Which of these is a label, which are features? Age, number of earlier visits, returned within 30 days.

  1. Label: returned within 30 days. (1 mark)
  2. Features: age and number of earlier visits. (1 mark)
  3. Both features are known before the prediction is needed. (1 mark)
  4. The label is not known until 30 days pass, so it is not available at prediction time. (1 mark)

Phase 3: Practise

Step 6 Learner practice (instant-marked)

1. In a housing table, which column is the label?

2. What are the columns that describe each example called?

3. Why can the sale price not be a feature for predicting the sale price?

4. A feature must be recorded:

Phase 4: Close

Step 7 Recap

  • Rows are examples; columns are features and one label.
  • Features must be known at prediction time.
  • Using the answer as a feature is leakage.

Step 8 Exit ticket (ungraded)

Draw a small table of four examples for a prediction task of your choice, and mark features and label.

Private: nothing you type here is sent or stored.

Step 9 Go further (Extension)

Think of a feature that would be useful but not available when the prediction is needed.

Common mistakes

MistakeWhy it fails
Including the answer among the featuresThat is leakage.
Mixed units in a columnThe rule cannot compare them.
Choosing features by habitA feature should carry information about the label.

Limits. The housing table is invented and tiny. Real tables have thousands of rows and many features.