Ravindra BagaleCourses & study guides मराठी Track your progress

29. What Is Machine Learning (Simple Explanation)

Data Science

29.3 Supervised vs Unsupervised Learning (Plain English)

Why. Before any sklearn line, you must know if your table already has the answer column or not. That choice is supervised vs unsupervised.

What.

  • Supervised learning — each training row has a label (the answer). Example: past orders with a column was_late = 0 or 1. The model learns to guess was_late for new orders.
  • Unsupervised learning — no answer column. The model finds groups or structure. Example: cluster customers into “busy weekday” vs “festival shopper” without a pre-written group name.

How.

Classify the problem in one minute

  1. Look at your clean table. Is there a column that is the thing you want to guess later?
  2. If yes → supervised (later: regression for numbers, classification for categories).
  3. If no, and you want natural groups → unsupervised (later: clustering).
  4. Write the label name on paper before coding. Empty label name = stop.
import pandas as pd

# Supervised-ready (fictional): label = was_late
orders = pd.DataFrame({
 "city": ["Pune", "Solapur", "Nashik", "Kolhapur"],
 "items": [4, 2, 8, 3],
 "rain_mm": [0, 12, 0, 3],
 "was_late": [0, 1, 0, 0], # label we already know for PAST rows
})
print("Supervised label column:", "was_late" in orders.columns)

# Unsupervised-ready: no label — only features
customers = pd.DataFrame({
 "city": ["Pune", "Pune", "Nagpur", "Nagpur"],
 "orders_30d": [12, 2, 9, 1],
 "avg_basket_inr": [220, 90, 180, 70],
})
print(customers)
print("No answer column — clustering could group these later.")

What you should see. First table has was_late. Second does not. That single fact decides the learning type.

Ravindra Bagale's Tip

If an interviewer asks, “What is supervised learning?”, answer in one simple line. Say: “The past rows already have an answer column, and the model learns to guess that answer for new rows.” A short and clear answer like this shows that you really understand the idea.