Arjun is a data scientist at NeoBank, a digital banking startup in Mumbai. One Monday morning, the product team sends four different data requests:
Request 1: "Will applicant X default on their loan?" Request 2: "How much loan can we approve for applicant Y?" Request 3: "What customer segments exist in our 10,000 applicants?" Request 4: "Flag suspicious transactions for compliance."
Arjun realizes these are four different types of problems—each needs a different ML approach. He can't fit them all into one model. Instead, he classifies each problem type, picks the right algorithm, and ships four solutions.
The 4 ML problem types
Every ML problem falls into one of these categories. Understanding which is step 1.
Decision flowchart: how to classify your problem
Use this flowchart to identify which type of problem you're solving:
4 example plots: visualizing each problem type
Here's what each problem type looks like when plotted:
Example 1: Classification (default prediction)
Example 2: Regression (loan amount prediction)
Example 3: Clustering (customer segments)
Example 4: Anomaly detection (fraud)
Metrics by problem type
Different problems need different success metrics:
| Problem Type | Example Metric | What It Measures | Scikit-learn class |
|---|---|---|---|
| Classification | F1 Score, AUC | How many defaults did we correctly flag? | LogisticRegression |
| Regression | RMSE, R² | How close was our loan prediction to actual? | LinearRegression |
| Clustering | Silhouette Score | How tight are the customer segments? | KMeans |
| Anomaly | Precision, Recall | Of detected anomalies, how many are real fraud? | IsolationForest |
Scikit-learn patterns: the same API for all
Every ML model in scikit-learn follows the same pattern: fit(X, y) → predict(X_new). Here's how each problem type differs:
Classification: LogisticRegression
Regression: LinearRegression
Clustering: KMeans
Anomaly Detection: IsolationForest
How real-world AI uses this
Every AI system you use relies on problem classification. Gmail's spam filter is classification. Netflix's rating prediction is regression. Spotify's "Discover Weekly" is clustering. Your bank's fraud detector is anomaly detection. Understanding these four types is understanding how AI actually works.
Also used in...
Domain spotlight
Task: Your manager at NeoBank sends you 5 requests. Classify each as classification, regression, clustering, or anomaly detection:
(a) "Predict customer lifetime value in rupees"
(b) "Detect fraudulent transactions"
(c) "Group customers by behavior for targeted marketing"
(d) "Will this customer open a savings account? Yes/No"
(e) "What's the expected loan default rate for this segment?"
Hint: Look for keywords:
• "Predict... number" → Regression
• "Predict... category" → Classification
• "Group/segment" → Clustering
• "Detect outliers/anomalies" → Anomaly detection
Answers: (a) Regression, (b) Anomaly, (c) Clustering, (d) Classification, (e) Regression
Interview questions: test your understanding
Quiz: 5 questions to test your knowledge
Cheatsheet: problem types at a glance
| Type | Output | Labels? | Example Metric | Scikit-learn class |
|---|---|---|---|---|
| Classification | Category (discrete) | Yes | F1, AUC | LogisticRegression |
| Regression | Number (continuous) | Yes | RMSE, R² | LinearRegression |
| Clustering | Group ID | No | Silhouette | KMeans |
| Anomaly | Normal/Outlier | Sometimes | Precision | IsolationForest |
Common mistakes: what breaks and how to fix it
LogisticRegression or DecisionTreeClassifier, not LinearRegression.Key takeaways
- Every ML problem is one of 4 types: classification (category), regression (number), clustering (groups), anomaly (outliers).
- The first question to ask: do you have labels? Yes → supervised (classification/regression). No → unsupervised (clustering/anomaly).
- Scikit-learn uses the same API for all:
fit(X, y)→predict(X_new). Only the model class changes. - Different problems need different metrics. Accuracy is wrong for imbalanced data. Silhouette Score is wrong for classification.
- Real-world systems mix all 4. Netflix classifies "user likes movie?", regressses "rating prediction", clusters "similar users", detects "bot activity".
Ready to code your first model?
Join the Best AI Program: The AI-Era Analyst — 5 months, fully online, with placement assistance. Week 1 is free.
Explore The AI-Era Analyst →