Types of Machine Learning
Not all Machine Learning problems are the same. Some tasks come with labeled answers, some do not, and some require an agent to learn through trial and error. Machine Learning splits into three main types based on how the algorithm receives information and learns from it.
Overview of the Three Types
Machine Learning
│
├──► Supervised Learning (learns from labeled data)
│
├──► Unsupervised Learning (finds patterns in unlabeled data)
│
└──► Reinforcement Learning (learns by reward and penalty)
Supervised Learning
In supervised learning, every training example comes with a correct answer (called a label). The algorithm compares its guess to the correct answer and adjusts until it gets close enough. The word "supervised" means a teacher is present in the form of labels.
Real-Life Analogy
A math teacher gives students solved problems as practice. The students check their own answers against the solutions and correct mistakes. Over time, they learn to solve new problems independently.
Common Supervised Learning Tasks
┌─────────────────┬──────────────────────────────────────────────┐ │ Task Type │ Example │ ├─────────────────┼──────────────────────────────────────────────┤ │ Classification │ Is this email spam or not spam? │ │ Regression │ What will the house sell for next month? │ │ Classification │ Does this scan show cancer or not? │ │ Regression │ How many units will this product sell? │ └─────────────────┴──────────────────────────────────────────────┘
Classification vs Regression
- Classification: The output belongs to a category. Examples: Yes/No, Cat/Dog, Spam/Not Spam.
- Regression: The output is a number on a continuous scale. Examples: price, temperature, sales count.
Simple Diagram
Supervised Learning Flow: Labeled Data: House Size=1500sqft → Price=$250,000 House Size=2000sqft → Price=$310,000 House Size=1200sqft → Price=$190,000 Model learns the pattern: Bigger size → Higher price New Input: House Size=1800sqft Prediction: ~$280,000
Unsupervised Learning
Unsupervised learning receives data without any labels or correct answers. The algorithm discovers hidden structure or groupings on its own. No teacher exists here — the algorithm finds patterns by exploring the data independently.
Real-Life Analogy
A librarian receives a large pile of unsorted books with no categories. After reading titles and descriptions, the librarian groups them — science fiction together, history together, cooking together — based on similarities. No one told the librarian which group each book belongs to.
Common Unsupervised Learning Tasks
┌──────────────────────┬──────────────────────────────────────────┐ │ Task Type │ Example │ ├──────────────────────┼──────────────────────────────────────────┤ │ Clustering │ Group customers by buying habits │ │ Dimensionality │ Compress 100 features into 5 key ones │ │ Reduction │ │ │ Anomaly Detection │ Find unusual transactions in bank data │ └──────────────────────┴──────────────────────────────────────────┘
Simple Diagram
Unlabeled Customer Data: Customer A: Buys sports items frequently Customer B: Buys books and stationery Customer C: Buys sports items frequently Customer D: Buys electronics Algorithm Groups Them: Group 1: A, C (Sports lovers) Group 2: B (Students) Group 3: D (Tech buyers)
Reinforcement Learning
Reinforcement learning trains an agent to make decisions inside an environment. The agent takes actions, receives rewards for correct moves, and receives penalties for wrong moves. Over time, it learns the best strategy to maximize total reward.
Real-Life Analogy
A dog learns tricks through training. When it sits on command, it gets a treat (reward). When it ignores the command, it gets no treat (penalty). After enough repetitions, the dog always sits on command because it learned that sitting leads to treats.
Key Components
┌──────────────┬──────────────────────────────────────────────────┐ │ Component │ Description │ ├──────────────┼──────────────────────────────────────────────────┤ │ Agent │ The learner (the program making decisions) │ │ Environment │ The world the agent operates in │ │ Action │ A move the agent makes │ │ Reward │ Score given after an action (+ve or -ve) │ │ Policy │ The strategy the agent develops over time │ └──────────────┴──────────────────────────────────────────────────┘
Simple Diagram
Reinforcement Learning Loop: Agent │ ▼ Takes Action (e.g., moves left in a maze) │ ▼ Environment responds │ ├──► Reward (+1 if closer to exit) └──► Penalty (-1 if hits a wall) │ ▼ Agent updates its strategy │ ▼ (Loop repeats until agent reaches the goal consistently)
Where Reinforcement Learning Works
- Game playing (chess, video games)
- Robot navigation
- Self-driving vehicles
- Trading systems
Comparison Table
┌─────────────────────┬──────────────┬───────────────┬──────────────────┐ │ Feature │ Supervised │ Unsupervised │ Reinforcement │ ├─────────────────────┼──────────────┼───────────────┼──────────────────┤ │ Labels in data? │ Yes │ No │ No │ │ Goal │ Predict │ Discover │ Maximize reward │ │ Teacher present? │ Yes │ No │ No (uses reward) │ │ Output │ Class/Value │ Groups │ Policy/Strategy │ │ Example algorithm │ Linear Reg. │ K-Means │ Q-Learning │ └─────────────────────┴──────────────┴───────────────┴──────────────────┘
A Fourth Type: Semi-Supervised Learning
Some real-world datasets contain a small portion of labeled data and a large portion of unlabeled data. Semi-supervised learning uses both together. The labeled data guides the model, and the unlabeled data helps it generalize better.
Example: A hospital has 10,000 medical images. Only 500 are labeled by doctors (expensive and time-consuming). Semi-supervised learning uses those 500 labeled images plus the remaining 9,500 unlabeled images to build a strong model.
Choosing the Right Type
Decision Guide:
Do you have labeled data?
│
├── Yes → Supervised Learning
│
└── No → Do you want to find groups or patterns?
│
├── Yes → Unsupervised Learning
│
└── Is an agent making decisions over time?
│
└── Yes → Reinforcement Learning
