Classification vs Regression Tasks
What you'll learn: How to distinguish between predicting categories (classification) and predicting numbers (regression) in supervised machine learning.
The Core Distinction
While both classification and regression involve learning from labeled examples in supervised learning, they differ fundamentally in what kind of output they predict:
- Classification predicts a discrete class label from a finite set of categories
- Regression predicts a continuous numerical value that can fall anywhere on a scale
Understanding Through Examples
Think of classification as sorting mail into bins. An email spam filter asks: "Is this spam or not spam?" A medical diagnosis system asks: "Does this patient have disease A, B, or C?" The answer is always a distinct category—you can't be "73% spam" as a final prediction; you're either spam or not.
Regression, on the other hand, is like predicting the temperature tomorrow or someone's height. You're not choosing from preset buckets—you're estimating a specific number. Predicting a house price of $347,892.50 is fundamentally different from classifying it as "expensive" or "affordable."
Key Characteristics
Classification outputs:
- Discrete categories (e.g., "cat", "dog", "bird")
- Binary (two classes) or multi-class
- Often expressed as probabilities, but final prediction is a label
Regression outputs:
- Real numbers (e.g., 23.7, -15.2, 1000000.45)
- Continuous range of possible values
- Can be positive, negative, or zero
Making the Choice
The nature of your label determines the task type. If your training data labels are categories, it's classification. If they're measurements or counts treated as continuous values, it's regression.
Key Takeaway: Classification predicts which category something belongs to, while regression predicts how much or how many—the difference lies in whether your target is discrete classes or continuous values.