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.
| Home | Area (m²) — feature | Bedrooms — feature | Sale price (£ thousands) — label |
|---|---|---|---|
| A | 60 | 2 | 200 |
| B | 75 | 3 | 240 |
| C | 90 | 3 | 280 |
| D | 50 | 1 | 170 |
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.
- Label: returned within 30 days. (1 mark)
- Features: age and number of earlier visits. (1 mark)
- Both features are known before the prediction is needed. (1 mark)
- 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?
The label is what we want to predict.
2. What are the columns that describe each example called?
Features are the known inputs.
3. Why can the sale price not be a feature for predicting the sale price?
Using it would be leakage.
4. A feature must be recorded:
Consistent units are essential.
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
| Mistake | Why it fails |
|---|---|
| Including the answer among the features | That is leakage. |
| Mixed units in a column | The rule cannot compare them. |
| Choosing features by habit | A feature should carry information about the label. |
Limits. The housing table is invented and tiny. Real tables have thousands of rows and many features.