Home / Learn / Data & AI / ML foundations / Lesson 1.2
All lessons

Module 1: Data, models and the maths you need · Lesson 1.2 · about 15 min

Data, features, labels and models

Rows are examples, columns are features, and the column you want to predict is the label. Learn the words used in every dataset, and how the label decides whether you need regression, classification or clustering.

Key points, meanings and formulas on one page: choose "Save as PDF" in the print box.

Module 1 · about 15 minutes · read first: 1.1. You’ll be able to name the parts of a dataset, say which column is the label, and tell regression, classification and clustering apart.

A dataset is a table: each row is one example, each column is a fact about it, and the one column you want to predict is the label.

1. Why this matters

Every machine learning conversation uses the same handful of words: example, feature, label, model, prediction. Different fields use different names for the same thing (a statistician says “variable” where a data scientist says “feature”). Learn the words now and every later lesson reads easily.

2. The parts of a dataset

Picture a class register. Each line is a pupil, each column is a fact about that pupil, and somewhere is the exam result you would like to forecast. Most data used for learning looks exactly like that:

  • Each row is one example (also called an observation, record or instance): one home, one customer, one day.
  • Each column is one feature (also called a variable, attribute, input or predictor): floor area, age, day of the week.
  • One column is special: the label (also called the target, output or response). It is the thing you want to predict.

Tap the column headings below to choose different labels.

Try it: pick what to predict

Tap a column heading to make it the label. Tap it again for no label. On a phone, slide the table sideways to see every column.

Row
1722Centre35410yes
21203Suburb12520yes
3953Suburb40430no
4601Centre8380yes
51804Edge22560no
61404Edge5590no

Each row is one example (one home). Each column is a feature, except the one you want to predict, which is the label. Whether the label is a number or a category decides the kind of model you need. Made-up homes.

The same table can answer different questions. If the label is sale price, you are predicting a number. If the label is “sold within 30 days?”, you are predicting yes or no. If you pick no label at all, you can still ask “which homes are alike?”.

3. Three kinds of learning

Kind What you have What it predicts Examples In this course
Regression (supervised) Features and a number label A number Price, temperature, sales next week Module 3
Classification (supervised) Features and a category label A category, often with a probability Spam or not, which digit, will cancel Modules 4 to 6
Clustering and other unsupervised work Features only Groups, patterns, odd cases Customer segments, fraud that looks unusual Module 8

“Supervised” means the right answers act like a teacher marking homework: the model can check itself against them. “Unsupervised” means there is no teacher, so the model can only look for patterns on its own. Language models (Module 10) use a clever trick: the label is simply the next word of real text, so nobody has to write labels by hand.

4. The model as a machine with dials

A model takes the features of one example and returns a prediction. Inside it are parameters: numbers that training adjusts, like dials on a mixing desk. It helps to picture three parts:

  1. Inputs: the features of one example, written as a list of numbers 𝐱=(x1,x2,…,xd). A list like this is called a vector (Lesson 1.4). d is how many features there are.
  2. The model: a function f with parameters θ (the Greek letter theta, which just means “all the dials”).
  3. Output: the prediction yˆ=f(𝐱;θ). Read it as “y-hat equals f of x, using dials theta”.

Training is choosing θ so that yˆ is close to the true label y on the training examples. Everything from a straight line to a language model fits this picture.

x (features)
What you know about one example, as a list of numbers: floor area, bedrooms, age.
y (label)
The true answer for that example, such as the price it really sold for.
ŷ (prediction)
The model's guess for y. The hat means "estimated".
θ (parameters)
The dials inside the model that training sets.
n and d
n is the number of rows (examples); d is the number of feature columns.
Physical meaning
A model is a machine you feed facts into and get a guess out of. The features are the facts you can see today; the label is the fact you will only see later (the sale price, the cancellation). Learning means using the past, where you saw both, to guess the future, where you see only the first.
Maths and principle

Principle: a dataset is a table of numbers X with n rows and d feature columns, plus a label column 𝐲 of length n.

Notation used in this course:

X=(x11x12⋯x1dx21x22⋯x2d⋮⋮xn1xn2⋯xnd),𝐲=(y1y2⋮yn)

xij is the value of feature j for example i. Row i of X is the vector 𝐱i. A model is a function yˆi=f(𝐱i;θ).

Analogy: the table is a class register. Each row is a pupil, each column a fact about them, and the label is the exam result you want to forecast.

Try it: the home table above has 6 rows. If sale price is the label, what are n and d? (n=6 examples and d=5 features.)

5. Features need to be numbers

Models do arithmetic, so every feature must end up as a number. Numbers stay as they are (after scaling, Lesson 2.4). Categories are turned into numbers, most often by one-hot encoding: one yes/no column per category. Think of a row of light switches, one per area, with only one switched on.

Area → Area = Centre Area = Suburb Area = Edge
Centre 1 0 0
Edge 0 0 1

Watch one raw row become the numbers a model can read:

The raw row. A home: 95 m², 3 bedrooms, 40 years old, area "Suburb", sold for $354,000.
Set the label aside. We want to predict the price, so $354,000 becomes y. It is the answer, not an input.
Keep the numbers. Floor area 95, bedrooms 3 and age 40 are already numbers, so they stay.
One-hot the category. "Suburb" becomes three switches: Centre 0, Suburb 1, Edge 0.
The feature vector. x = (95, 3, 40, 0, 1, 0). That is d = 6 numbers, ready for any model in this course.

“Just number the categories: Centre = 1, Suburb = 2, Edge = 3.” That tells the model Edge is “three times” Centre and Suburb sits exactly halfway between them, which means nothing. The model would happily learn rules based on that fake order. One-hot columns carry no fake order. Only truly ordered categories (S, M, L, or “poor, fair, good”) can safely be numbered in order.

6. Worked example

Made-up numbers. A hospital team wants to flag patients likely to come back within 30 days. Their table has one row per hospital stay (12,400 rows). Features: age, number of medicines, days in hospital, number of visits in the past year, and ward (one of 6 wards, one-hot encoded into 6 columns). That is 4 + 6 = 10 feature columns, so d=10. The label is “readmitted within 30 days” (yes or no), so it is a classification problem. If instead they wanted “how many days until readmission”, it would be regression. And if they had no outcome at all and wanted to find types of patients, it would be clustering.

7. Practice

  1. A weather service predicts tomorrow’s rainfall in millimetres. Regression or classification?
  2. A bank predicts whether a card payment is fraud. What is the label, and is it regression or classification?
  3. A column “City” has 4 values. How many columns does one-hot encoding make?
Answers
  1. Regression: the label is an amount.
  2. The label is fraud (yes or no): classification.
  3. Four, one per city (some tools drop one of them, because it can be worked out from the other three).

Try it on your own data: open a CSV in the CSV profiler to see each column’s type and gaps before you choose a label.

New words: example (a row), feature (an input column), label or target (the column to predict), supervised and unsupervised, regression, classification, clustering, one-hot encoding.

  • Rows are examples, columns are features, and the column you want to predict is the label.
  • A number label means regression; a category label means classification; no label means unsupervised work such as clustering.
  • A model is a function ŷ = f(x; θ) with dials θ that training sets.
  • Every feature must become a number; categories are one-hot encoded, not numbered 1, 2, 3.

Check yourself

1You want to predict a flat's monthly rent in dollars. What kind of problem is it?
2In a table of patients, which is the label if the task is "will this patient be readmitted within 30 days?"
3A shop has customer purchase records but no labels, and wants to find groups of similar customers. What is this?

Sources

Your ticks stay in this browser. Save them as a file on the course home.

Updated 2026-11-22. Numbers in the examples are made up to show the idea unless a source is given. Simulations run in your browser; nothing you type is sent anywhere.