Two ways to learn a subject. One: a teacher gives you worked examples with the answers, you study the pattern, and then you attempt fresh questions. Two: nobody gives you answers at all — you are handed a pile of material and asked what it groups into.
Those are supervised and unsupervised learning, and the choice between them isn't yours. The data you have decides.
The question that decides
Do I have the right answer for each example? That single question routes almost every problem you will meet.
And one clarification that trips people up in interviews: "supervised" refers to the labels, not to a person watching. Nobody is supervising the training. The data carries its own supervision.
Supervised learning
Every training row comes with the correct answer, and the algorithm learns the mapping from inputs to that answer. It splits into two tasks by the type of the target:
| Classification | Regression | |
|---|---|---|
| Target | a category from a fixed set | a continuous number |
| Examples | spam / not spam, 6 ticket categories, will churn / won't | house price, delivery minutes, tomorrow's demand |
| Typical algorithms | logistic regression, trees, random forest, XGBoost | linear regression, trees, XGBoost |
| Typical metrics | precision, recall, F1, ROC-AUC | RMSE, MAE, R² |
# Classification — the target is a category
X = df[["amount", "hour", "distance_from_home", "prior_declines"]]
y = df["is_fraud"] # 0 or 1, labelled from history
model = RandomForestClassifier().fit(X_train, y_train)
model.predict_proba(new_txn) # -> probability of fraud
# Regression — the target is a number
X = df[["area_sqft", "bedrooms", "distance_metro_km"]]
y = df["rent"] # ₹, a continuous value
model = LinearRegression().fit(X_train, y_train)
model.predict(new_flat) # -> a rupee amount💡 Notice predict_proba in the classification example. Most classifiers can give you a probability, not just a class — and in production that is usually more useful, because it lets you rank cases and set a threshold from business economics (lesson 6).
Unsupervised learning
No labels. The algorithm finds structure in the data itself. Three common tasks:
- Clustering — grouping similar items. Customer segmentation, grouping news articles by topic when nobody has defined the topics.
- Dimensionality reduction — compressing many correlated features into a few, mostly for visualisation, noise reduction or speed (PCA, lesson 8).
- Anomaly detection — learning what normal looks like and flagging deviations, when you have no examples of "abnormal".
from sklearn.cluster import KMeans
X = df[["recency_days", "order_count", "total_spend"]] # no y at all
model = KMeans(n_clusters=4, n_init=10).fit(X)
df["segment"] = model.labels_
print(df.groupby("segment")[["recency_days", "order_count", "total_spend"]].mean())Result
The algorithm found four groups. It did not tell you what they mean — that reading is yours: segment 0 looks like loyal regulars, segment 1 like lapsed customers, segment 2 like infrequent big spenders. Unsupervised learning produces groups, not meanings.
Reinforcement learning
A third mode, and one you should be able to describe even though you're unlikely to build one at placement level. An agent takes actions in an environment and receives rewards or penalties. Over many attempts it learns which sequences of actions lead to the best outcome.
No labelled "correct move" exists — only the consequence. Game playing, robotics, and sequencing decisions are the classic applications. It also appears in LLM training as RLHF, which is why the term shows up in AI interviews (fine-tuning lesson 2).
Why it is rare in business settings: it needs a safe place to experiment and a clear numeric reward. Neither is easy when the experiments involve real customers and real money.
Wait — how do you grade something with no answers?
This is the honest difficulty of unsupervised learning, and a good interview question.
With labels, evaluation is straightforward: compare predictions to the truth. Without them, there is no ground truth to compare against. You can measure internal properties — the silhouette score tells you whether clusters are tight and well-separated — but that measures geometry, not usefulness.
So the real evaluation is a judgement call: are these groups meaningful and actionable to the people who will use them? Six mathematically tidy customer segments that marketing cannot run different campaigns for are worse than four they can.
🎯 Selection-round radar: "Difference between supervised and unsupervised learning" is one of the most-asked ML questions anywhere. Define both, give one example each, and then add the two lines that separate you: classification versus regression splits supervised by target type, and unsupervised results have no ground truth, so a human has to decide whether the output is useful.
The realistic middle ground
Real projects rarely have either perfect labels or none. Two terms worth knowing:
Semi-supervised learning — a small labelled set and a large unlabelled one. Common when labelling is expensive: 200 X-rays read by a radiologist and 10,000 unread.
Transfer learning — start from a model already trained on a large general dataset and adapt it to your small one. For the X-ray case this is usually the strongest practical answer, and it is the same idea as fine-tuning an LLM (fine-tuning lesson 1).
There is also self-supervised learning, where labels are generated from the data itself — predicting the next word in a sentence needs no human labeller, which is exactly how large language models are pretrained.
Common mistakes
- Thinking "supervised" means a human watches training.
- Calling a numeric prediction "classification" or vice versa.
- Expecting a clustering algorithm to name or explain its groups.
- Choosing a learning type by preference rather than by the data available.
- Discarding unlabelled data instead of using transfer or semi-supervised learning.
- Reporting a silhouette score as if it proved the clusters were useful.
Quick recap
| Concept | One-liner |
|---|---|
| The deciding question | do I have the right answer for each example? |
| Supervised | labelled data; category target = classification, numeric = regression |
| Unsupervised | no labels; clustering, dimensionality reduction, anomaly detection |
| Reinforcement | learn from rewards for actions; needs a safe place to experiment |
| Evaluating unsupervised | no ground truth — usefulness is a human judgement |
| Middle ground | semi-supervised, transfer learning, self-supervised |
Practice Zone — PYQs from real selection rounds
Six MCQs, then two tasks: route six problems to the right learning type, and explain all three to a non-technical manager.
What defines supervised learning?
Asked in

Which is an unsupervised learning task?
Asked in

What is the difference between classification and regression?
Asked in

What is reinforcement learning?
Asked in

You have 10,000 medical images but only 200 are labelled by a doctor. What approach fits best?
Asked in

Why is unsupervised learning harder to evaluate than supervised learning?
Asked in

Hands-on tasks:
For each, name the learning type and the specific task: (1) predicting delivery time in minutes, (2) grouping news articles by topic with no predefined topics, (3) deciding if a transaction is fraudulent, (4) a game AI learning to win, (5) predicting which of 8 categories a support ticket belongs to, (6) finding unusual server behaviour with no examples of 'unusual'.
Asked in

In under a minute, explain supervised, unsupervised and reinforcement learning to a business stakeholder, with one example each from their world.
Asked in

FAQ
Can the same problem be supervised or unsupervised?
Yes, and it depends entirely on your labels. Fraud detection with labelled historical fraud is imbalanced classification; the same problem with no labelled fraud becomes anomaly detection. Interviewers use this to check whether you classify by the data you have rather than by the words in the question.
Is clustering the same as classification?
No, and it is a common slip. Classification assigns items to predefined categories learned from labelled examples. Clustering discovers groups nobody defined, and the groups have no names or meanings until a human supplies them.
Where do LLMs fit in this taxonomy?
Pretraining is self-supervised — predicting the next token creates its own labels from raw text. Instruction tuning is supervised, on (instruction, response) pairs. And preference tuning uses reinforcement-style learning from human comparisons. All three, in sequence (GenAI lesson 2).
Next lesson: the first and most important supervised algorithm — Lesson 3: Regression Explained →


