Types of Machine Learning
The Three Families of ML
Not all machine learning is the same. Depending on what kind of data you have and what goal you’re trying to achieve, you’ll use different types of ML.
Think of it like teaching someone:
- Supervised = teaching with a tutor who gives feedback
- Unsupervised = learning by exploring on your own
- Reinforcement = learning by trial and error (like a video game)
1. Supervised Learning 🎓
In supervised learning, the training data comes with correct answers (called labels).
The model learns: “Given this input, what should my output be?”
Example: Predicting House Prices
| Bedrooms | Size (sqft) | Location | Price |
|---|---|---|---|
| 2 | 1200 | Downtown | $450,000 |
| 4 | 2400 | Suburbs | $680,000 |
| 1 | 600 | Downtown | $280,000 |
The model learns the relationship between features (bedrooms, size, location) and the label (price). Then it can predict prices for new houses it hasn’t seen.
Two Subtypes
Classification — predict a category
Input: email text → Output: "spam" or "not spam"
Input: photo → Output: "cat", "dog", or "bird"
Input: patient data → Output: "has disease" or "doesn't have disease"
Regression — predict a number
Input: house features → Output: $450,000
Input: weather data → Output: 23.5°C temperature tomorrow
Input: ad data → Output: 3.2% click-through rate
Real-world supervised learning uses:
- Email spam filters
- Medical diagnosis assistance
- Credit card fraud detection
- Stock price prediction
2. Unsupervised Learning 🔍
In unsupervised learning, there are no labels — the model must find hidden patterns in the data on its own.
The model learns: “What natural groups or structures exist in this data?”
Example: Customer Segmentation
Imagine you run an online store. You have data about your customers:
Customer A: buys often, small amounts, mostly electronics
Customer B: buys rarely, large amounts, mostly luxury goods
Customer C: buys often, small amounts, mostly fashion
You don’t label them — you just let the ML model group similar customers together. It might discover:
- Group 1: Frequent small buyers (budget shoppers)
- Group 2: Rare big buyers (luxury shoppers)
- Group 3: Trend followers
Common Unsupervised Techniques
| Technique | What it does |
|---|---|
| Clustering | Groups similar data points together |
| Dimensionality Reduction | Compresses data while keeping important info |
| Anomaly Detection | Finds unusual outliers |
| Association Rules | Finds “people who buy X also buy Y” |
Real-world uses:
- Customer segmentation
- Recommendation systems
- Fraud detection (finding unusual transactions)
- Topic modeling in documents
- Gene expression analysis
3. Reinforcement Learning 🎮
In reinforcement learning, an agent learns by interacting with an environment and receiving rewards or penalties.
No labeled data. The agent just tries things and learns what works.
Agent takes action → Environment gives reward or penalty → Agent learns to maximize reward
The Classic Example: Learning to Play Chess
- Agent: The chess-playing AI
- Environment: The chess board
- Actions: Moving pieces
- Reward: +1 for winning, -1 for losing, 0 for each move
- Goal: Learn the strategy that wins most games
The agent starts playing randomly. Over millions of games, it discovers what moves lead to wins.
Real-world uses:
- Game-playing AIs (AlphaGo, OpenAI Five)
- Robot locomotion
- Autonomous vehicle control
- Trading bots
- RLHF in ChatGPT (teaching LLMs to be helpful)
Quick Comparison
| Supervised | Unsupervised | Reinforcement | |
|---|---|---|---|
| Data | Labeled | Unlabeled | No fixed dataset |
| Goal | Predict known outputs | Find hidden patterns | Maximize reward |
| Feedback | Correct answers | None | Reward/penalty |
| Examples | Spam filter, price prediction | Customer grouping | Game-playing AI |
Which Should You Use?
Do you have labeled data?
├── Yes → Supervised Learning
│ ├── Predicting a category? → Classification
│ └── Predicting a number? → Regression
└── No → Unsupervised Learning
└── Learning via interaction? → Reinforcement Learning
You want to build a system that groups news articles into topics automatically, without knowing the topics in advance. Which type of ML should you use?
AlphaGo learns to play Go by playing millions of games against itself and improving based on wins and losses. What type of ML is this?