You are viewing a public preview
Sign in to save your progress, do assignments, join discussions and get feedback.
After this unit you will: be able to assign a problem to the correct type: regression, classification, clustering or association.
| Group | Problem | Example on the slide |
|---|---|---|
| Supervised | Regression — the output is a continuous number | “What will tomorrow's temperature be?” → 84°F |
| Supervised | Classification — the output is a label | “Will tomorrow be hot or cold?” → HOT / COLD |
| Unsupervised | Clustering — group points into clusters | White dots → colored clusters |
| Unsupervised | Association — find rules that go together | If a customer buys item #1, recommend item #2 |
By the end of this lesson you can:
Key idea: In supervised learning, regression predicts a continuous number and classification predicts a category from a fixed set. The type of the output, not the input, decides which one you have.
The lecture uses one weather picture for both problems.
The lecturer calls this distinction probably the single most important concept in the whole course, because it decides which algorithms and which evaluation metrics you will use later.
| Regression | Classification | |
|---|---|---|
| Output | A continuous number | A category (class) from a fixed set |
| Weather example | Tomorrow's temperature: 84°F | Tomorrow: HOT or COLD |
| Other examples | House price, a person's salary, units sold next month | Spam or not spam, approve or reject a loan, cat or dog photo |
A quick test: ask "Could the answer be 2.7 or 84.3?" If yes, it is regression. If the answer must be picked from a short list of names, it is classification. Note that the same inputs can serve both problems; only the question you ask about the output changes.
Unsupervised learning has no labels, so it does not predict a known answer. The lecture shows two typical problems.
Clustering groups similar data points together without knowing in advance what the groups should be. On the slide, a cloud of white dots becomes three coloured groups (green, blue and red). The algorithm decided the groups; nobody told it. A retailer might analyse purchase histories and discover three natural customer segments, such as budget shoppers, premium shoppers and occasional buyers, without defining those segments beforehand.
Association discovers rules about items that go together: "if a customer buys item #1, recommend item #2". This is the logic behind "customers who bought this also bought..." recommendations on e-commerce websites.
| Group | Problem | Output | Example |
|---|---|---|---|
| Supervised | Regression | A number | Tomorrow's temperature |
| Supervised | Classification | A label | HOT or COLD |
| Unsupervised | Clustering | Groups of similar points | Customer segments |
| Unsupervised | Association | If-then rules between items | Buy item #1, recommend item #2 |
This course focuses on supervised learning, so clustering and association appear only as context. You are likely to meet them later in your data science career.
The same weather data can become a regression problem or a classification problem, depending on which target column you choose.
import pandas as pd
weather = pd.DataFrame({
"day": ["Mon", "Tue", "Wed", "Thu"],
"temp_f": [84, 70, 91, 65],
})
# Regression target: the temperature itself (a continuous number)
y_regression = weather["temp_f"]
# Classification target: the same information turned into a label
weather["hot_or_cold"] = (weather["temp_f"] >= 80).map({True: "HOT", False: "COLD"})
y_classification = weather["hot_or_cold"]
print(weather)
Expected output:
day temp_f hot_or_cold
0 Mon 84 HOT
1 Tue 70 COLD
2 Wed 91 HOT
3 Thu 65 COLD
y_regression asks the model for a number such as 84. y_classification only asks for HOT or COLD. The threshold of 80°F is a business choice made for this example. Changing the question changed the problem type, so you would switch to a different family of algorithms and different metrics.
Flashcards · 1.4 Regression, classification, clustering, association
8 wordsA supervised problem where the model predicts a continuous numeric value.
A supervised problem where the model predicts one category from a fixed, limited set of classes.
One of the possible categories a classification model can output.
A number that can take any value within a range, including decimals.
An unsupervised problem that groups similar data points without knowing the groups in advance.
An unsupervised problem that finds rules about items that tend to occur together.
Splitting customers into natural groups based on behaviour, a typical use of clustering.
Decide the problem type by asking whether the output is a number or a label.