Choosing Among Supervised Models
Match the model to the data and the constraint
Pick the starter model from data size, non-linearity, interpretability, and latency — then escalate on evidence: linear baseline first, then trees/forests/GBM, kernels for special cases.
What you will learn
- Map problem traits to a shortlist of model families
- Start every project from a strong, interpretable baseline
- Escalate to ensembles only with evidence of a gap
What is this?
Choosing a supervised model is a trade of interpretability, non-linearity capacity, data efficiency, latency and maintenance cost. ROUGH guide: <1k rows → linear/regularized; non-linearity suspected → trees; interactions + robustness → forests/GBM; tiny sets with separable geometry → SVM; text/images/audio → deep networks. Always start with a linear baseline and only escalate on validation evidence.
Why do you need it?
- Most B2B tabular problems hover near-linear: a linear baseline often needs no replacement.
- Interpretability saves audit, debugging and trust cost that hidden gains rarely cover.
- Tuning a good baseline tells you whether capacity was even the gap.
- Latency/budget constraints in production can rule out models regardless of accuracy.
Mental model
Choosing a tool from a toolbox by the job
Model selection
A hammer nails most frames; you escalate to a nail gun only when volume proves it. Nobody selects a chainsaw to screw in a light bulb.
How it works
- List constraints: data size, dimension, interpretability (legal/audit), latency, retrain cadence.
- Set the baseline: regularized linear model + the business heuristic you're beating.
- Test capacity hypotheses: fit one tree/forest; if it beats linear clearly, non-linearity matters.
- Escalate on validation evidence, not PR: each candidate must clear baseline + a confidence margin.
- Re-check the winner under the latency/audit constraints before deployment.
Starter-model selector.
Examples
The escalate-on-evidence template
import numpy as npfrom sklearn.datasets import make_classificationfrom sklearn.model_selection import cross_val_scorefrom sklearn.linear_model import LogisticRegressionfrom sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifierfrom sklearn.preprocessing import StandardScalerfrom sklearn.pipeline import make_pipeline X, y = make_classification(n_samples=2000, n_features=14, n_informative=8, n_redundant=3, class_sep=0.9, random_state=0) candidates = { "logistic": make_pipeline(StandardScaler(), LogisticRegression(max_iter=2000)), "random_forest": RandomForestClassifier(n_estimators=200, random_state=0), "gradient_boost": GradientBoostingClassifier(random_state=0),}for name, m in candidates.items(): s = cross_val_score(m, X, y, cv=4, scoring="roc_auc") print(f"{name:>14}: AUC mean {s.mean():.4f} std {s.std():.4f}")Three families scored under identical CV — the linear baseline is always in the list, and escalation happens only when a more complex candidate clearly out-scores it.
In production
- Regulated credit: logistic wins because the model must be explained to auditors.
- High-volume ad serving: shallow trees with <1ms latency beat deep ensembling.
- Churn SaaS: GBM adds +0.04 AUC over linear and the ops team accepts the gain.
Best practices
- Report baseline vs candidates under identical CV; state the constraint list (interpretability, latency, retrain cadence) in the model card; revisit the choice quarterly as data volumes change.
Common mistakes
- Skipping the linear baseline; choosing a model by popularity rather than constraints; ignoring latency and retrain cost; treating 'more complex = better' as a rule.
Debugging tips
- If the tree/GBM can't beat linear by a real margin, question whether your features carry non-linear structure.
- Measure inference time properly (per-1k rows) before committing.
- Audit the winning model's explanation tool: SHAP on a GBM vs coefficient table on logistic — which does the stakeholder actually trust?
Interview checkpoint
Quick quiz
The mandatory starter every project should fit is:
Least-latency-friendly family of these?