Supervised vs Unsupervised Learning
Machine Learning · Beginner
Definition
Supervised learning learns from labeled examples; unsupervised learning finds structure in unlabeled data.
Choosing the right type is the first decision in any ML project.
Diagram
Flowchart
Example: Label check
data = [{'x': 1, 'y': 0}, {'x': 2}]
print(['supervised' if 'y' in d else 'unsupervised' for d in data])Output: ['supervised', 'unsupervised']
Key points
- Classification predicts classes
- Regression predicts numbers
- Clustering groups similar points
Interview questions
Spam detection is which type?
Supervised classification, because emails are labeled spam or not.