Model Evaluation: lesson 1 of 7
Model Evaluation
Why Baseline Models Matter
Use simple reference predictions to decide whether a model adds practical value.
Concept
A baseline is a simple reference strategy that answers: is our model actually better than something simple? A model score has little meaning without a comparison point.
Regression Baselines
For house prices, a simple baseline can predict the training-set mean or median price for every house. If a complex model cannot beat that reference on held-out data, investigate the features, target framing, pipeline, or evaluation before adding complexity.
from sklearn.dummy import DummyRegressor
baseline = DummyRegressor(strategy="median")
baseline.fit(X_train, y_train)
baseline_predictions = baseline.predict(X_test)
The median can be useful when prices contain influential extremes. This is not a good final model; it is an honest minimum standard.
Classification Baselines
For a 95% non-fraud dataset, always predicting non-fraud can look 95% accurate while finding no fraud. DummyClassifier(strategy="most_frequent") makes that weak strategy explicit. A model must improve the behavior that matters, not merely exceed a convenient headline score.
Why Baselines Reveal Problems
Baselines expose weak features, broken pipelines, inappropriate metrics, and unnecessary model complexity. They can also flag suspiciously strong results: a huge jump over a reasonable baseline may deserve a leakage check. A business rule, such as flagging purchases over a known limit, can also be a useful operational reference.
Two Kinds of Reference
A statistical baseline predicts from the target alone: mean or median for regression, majority class for classification. A business baseline follows a current rule or process, such as reviewing transactions above a fixed amount. Both are useful. The statistical baseline asks whether features add signal; the business baseline asks whether the proposed system improves the current decision. Beating a baseline is necessary, but not sufficient: the improvement must still be large enough and safe enough to matter.
Mean, Median, and Majority Class
For delivery-time prediction, the mean baseline predicts the average historical duration for every delivery. The median predicts the middle duration. When a few unusually delayed shipments pull the mean upward, the median can be a more robust reference because extreme values affect it less. Neither baseline uses route, weather, or carrier features, so beating it shows that those inputs may add predictive signal.
For classification, the majority-class baseline predicts the most common label. In a 95% legitimate-payment dataset, it can appear accurate while doing nothing useful for fraud. This connects directly to class imbalance: a model should improve the behavior for the decision that matters, not merely copy the dominant class.
Interpret Before Adding Complexity
If a complicated model barely beats a baseline, useful features may be missing, the target may be noisy, or the problem may not need ML. If it beats the baseline by an implausibly large amount, check for leakage, duplicated rows, or an evaluation error. A baseline cannot prove a model is good; it establishes the minimum comparison needed before complexity earns trust.
Failure Signals
Common Mistakes
- Comparing models only with other complex models.
- Calling a baseline useless because it is simple.
- Choosing a baseline metric that ignores the business objective.
- Fitting a baseline on test data.
Interview Perspective
Question: Why use a baseline? Answer: to verify that a learned model adds value beyond a simple strategy. What the interviewer is testing: practical evaluation judgment. Follow-up: what would you investigate if a complex model loses to a median baseline?
Practice Questions
- Choose a baseline for delivery-time prediction.
- Why can a majority-class classifier be misleading?
- Name one business-rule baseline for fraud review.
- What might an implausibly strong baseline improvement indicate?
- Why might a business-rule baseline differ from a median baseline?
Quick Quiz
- Is a baseline necessarily the final model? Answer: no.
- Which regression baseline handles extreme values more robustly? Answer: median.
- Should a baseline use held-out targets while fitting? Answer: no.
Key Takeaway
Key Takeaways
Baselines give model scores meaning. Beat a simple, valid reference before trusting extra complexity.
Next Lesson
Next, choose regression metrics that reflect the cost of prediction errors.
Finish this lesson on your terms
Mark it complete when you have worked through the material and are ready to move on.