Building in PublicRead Blog

Types of Machine Learning

D
Dev.Log
15 min read
5 views
Share:

Types of Machine Learning

ML isn't one-size-fits-all. Different problems need different learning strategies. Here's every major type—what it is, how it works, and when to use it.

The Big Picture

Machine Learning
├── Supervised Learning
│     ├── Classification
│     └── Regression
├── Unsupervised Learning
│     ├── Clustering
│     ├── Dimensionality Reduction
│     └── Association
├── Semi-Supervised Learning
├── Reinforcement Learning
└── Self-Supervised Learning

1. Supervised Learning

What it is

You train the model on labeled data—every input has a known correct answer. The model learns to map inputs to outputs.

Think of it as learning with a teacher who corrects you every time you're wrong.

How it works

Input data + Correct labels  →  Model trains  →  Predicts on new data

Two sub-types

Classification—"Which category does this belong to?"

Output is a discrete label (a class).

ExampleInputOutput
Spam detectionEmail textSpam / Not spam
Disease diagnosisPatient symptomsSick / Healthy
Image recognitionPhoto pixelsCat / Dog / Car
Sentiment analysisReview textPositive / Negative

Regression—"What number will this be?"

Output is a continuous number.

ExampleInputOutput
House price predictionSize, location, age₹85,00,000
Weather forecastingHumidity, pressure34°C
Stock price predictionHistorical prices₹2,340
Salary estimationExperience, skills₹12 LPA

When to use it

✅ You have labeled data ✅ You know what output you want ✅ Problem is either a category or a number

Real-world products

  • Gmail spam filter
  • Credit card approval systems
  • Medical imaging diagnosis tools

2. Unsupervised Learning

What it is

You train the model on unlabeled data—no correct answers provided. The model finds hidden structure or patterns on its own.

Think of it as exploring without a map. The model discovers what's interesting by itself.

How it works

Raw data (no labels)  →  Model finds structure  →  Groups / Patterns / Rules

Three sub-types

Clustering—"Which items are similar to each other?"

Groups data points that are naturally close together.

ExampleWhat it finds
Customer segmentationBudget shoppers, premium buyers, deal-hunters
News groupingSports articles, politics articles, tech articles
Gene analysisGroups of genes with similar behavior

🔬 Example: Spotify groups listeners into clusters like "lo-fi fans," "gym music lovers," "jazz aficionados"—without anyone labeling those groups first.

Dimensionality Reduction—"How do I simplify this without losing meaning?"

Compresses data with many features into fewer features while keeping the important information.

ExampleBeforeAfter
Face recognition1 million pixel values128 key measurements
Document analysis50,000 word counts20 topic scores

Used heavily before feeding data into other ML models to speed up training and remove noise.

Association—"What things tend to appear together?"

Finds rules about co-occurrence in data.

ExampleRule discovered
Supermarket basket analysis"People who buy bread + butter also buy eggs 78% of the time"
E-commerce"Users who buy a camera also buy an SD card"
Streaming"Users who watch Action also watch Thriller"

When to use it

✅ No labels available ✅ You want to explore and understand your data ✅ You're looking for natural groupings or hidden patterns

3. Semi-Supervised Learning

What it is

A mix of supervised and unsupervised. You have a small amount of labeled data and a large amount of unlabeled data. The model learns from both.

Why it matters

Labeling data is expensive and slow. Semi-supervised learning lets you get most of the benefit of supervised learning with a fraction of the labeled data.

How it works

Small labeled dataset + Large unlabeled dataset  →  Model learns structure + correct answers

Example

🏥 A hospital has 500 labeled X-rays (confirmed diagnosis) and 50,000 unlabeled X-rays. Semi-supervised learning uses all 50,500—the unlabeled ones help the model understand what X-rays generally look like, and the 500 labeled ones teach it what's healthy vs. diseased.

When to use it

✅ Labeling data is expensive or time-consuming ✅ You have lots of raw data but few labels ✅ Examples: medical imaging, speech recognition, web content classification

4. Reinforcement Learning (RL)

What it is

An agent learns by interacting with an environment. It takes actions, receives rewards for good moves and penalties for bad ones, and gradually learns the best strategy (called a policy).

No dataset required—the agent generates its own experience by exploring.

How it works

Agent observes state  →  Takes action  →  Gets reward/penalty  →  Updates strategy  →  Repeat

Key terms

TermMeaningExample
AgentThe learner / decision makerThe AI player
EnvironmentThe world it operates inThe game / simulation
StateCurrent situationBoard position in chess
ActionWhat the agent doesMove a piece
RewardFeedback signal+1 for win, -1 for loss
PolicyStrategy learned over time"In this situation, do this"

Example

🎮 AlphaGo—DeepMind's Go-playing AI. Never given rules for winning. Played millions of games against itself, learned which moves led to wins, and eventually beat the world champion.

🤖 Robot arm training—A robot arm learning to pick up objects. It gets a reward every time it successfully grabs something. After millions of attempts, it figures out the right grip and angle for any object.

When to use it

✅ The problem involves sequential decisions ✅ There's a clear reward signal (win/lose, score, efficiency) ✅ You can simulate the environment ✅ Examples: game AI, robotics, self-driving cars, recommendation systems

5. Self-Supervised Learning

What it is

A clever twist on supervised learning—the model generates its own labels from the data. No human labeling needed.

This is how large modern AI models (like GPT, BERT, DALL-E) are trained.

How it works

Raw data  →  Hide part of it  →  Model predicts the hidden part  →  Uses prediction error to learn

Examples

TaskInput givenModel predicts
Next word prediction"The cat sat on the ___""mat"
Masked word prediction"The [MASK] sat on the mat""cat"
Image patch prediction75% of an imageThe missing 25%
Next sentence predictionSentence 1Does sentence 2 follow?

🧠 ChatGPT was trained this way—fed billions of sentences from the internet, asked to predict the next word over and over. Through trillions of predictions and corrections, it learned grammar, facts, reasoning, and writing style—all from raw text with zero human labels.

When to use it

✅ You have massive amounts of raw, unlabeled data ✅ Labeling is impractical at scale ✅ You want to build general-purpose models ✅ Examples: LLMs (GPT, Claude), image models (CLIP, MAE), speech models (Wav2Vec)

Quick Comparison

TypeNeeds Labels?Data RequiredBest For
Supervised✅ Yes (all)MediumPrediction, classification
Unsupervised❌ NoAny amountExploration, clustering
Semi-Supervised⚡ FewLarge unlabeled + small labeledWhen labeling is expensive
Reinforcement❌ No (uses rewards)Generated by agentSequential decisions, games, robots
Self-Supervised❌ No (auto-generated)Very largeFoundation models, LLMs

How to Pick the Right Type

Do you have labeled data?
├── Yes → Supervised Learning
│         ├── Output is a category? → Classification
│         └── Output is a number?   → Regression
│
└── No →  Do you want to explore structure?
          ├── Yes → Unsupervised Learning
          │         ├── Find groups?        → Clustering
          │         ├── Simplify features?  → Dimensionality Reduction
          │         └── Find rules?         → Association
          │
          └── Is it a decision-making problem?
              ├── Yes → Reinforcement Learning
              └── No  → Do you have massive raw data?
                        ├── Yes → Self-Supervised Learning
                        └── Mix → Semi-Supervised Learning

TL;DR

  • Supervised—Learns from labeled examples. Predicts categories or numbers.
  • Unsupervised—No labels. Finds hidden groups, patterns, and rules.
  • Semi-Supervised—Mix of both. Great when labels are scarce.
  • Reinforcement—Learns by doing. Rewards good actions, penalizes bad ones.
  • Self-Supervised—Creates its own labels from raw data. Powers modern LLMs.

The type you choose depends on one thing: what data you have and what question you're trying to answer.