Data Science ยท Chapter 24 of 43
Regression vs Classification
REGRESSION predicts a NUMBER (price, temperature). CLASSIFICATION predicts a CATEGORY (spam / not spam).
Different metrics apply: MAE/RMSE for regression, accuracy/precision/recall for classification.
Example 1 (python)
# Regression: predict house price
from sklearn.linear_model import LinearRegressionRegression example.
Example 2 (python)
# Classification: predict spam vs not
from sklearn.linear_model import LogisticRegressionClassification example.
Key points
- Regression โ number.
- Classification โ category.
- Different metrics per task.
- Some algorithms handle both.
๐ก Note: Ordinal targets (like 1โ5 star ratings) sit between the two โ treat with care.
