Comparisons

Pairs that get conflated in real metric reviews and real design docs — batch and online, precision and recall, data drift and concept drift, validation and test. Neither column wins; what decides is the problem. Each record leads with the confusion, because the confusion is the reason the record exists.

k-fold cross-validation vs a single holdout

What people get wrong about this pair

k-fold is taught as the rigorous option and the holdout as the lazy one, and on temporal or grouped data the opposite is true. Folding a time series shuffles the future into the training set of every fold; folding user rows puts each user on both sides of some fold; the averaged metric is then a precise estimate of the wrong quantity. The strongest form of the k-fold side is statistical: on a few thousand exchangeable rows, a single split's metric moves by more than the differences you are trying to detect, and averaging over folds is the only way to see whether a change is real. It also uses every row for validation once. The strongest form of the holdout side is that a single forward-in-time holdout simulates deployment — train on the past, evaluate on the future — which is the question you are actually asking, and that a large holdout has an error bar small enough not to need folding. Grouped and time-series variants of cross-validation exist and are the reconciliation: fold by group, or roll the origin forward. The choice is decided by how the model will be used, not by which one sounds more careful.

k-fold — split the data into k parts, train k times, average the validation metric
Use it when

When the data is small enough that one split gives a noisy metric, when the rows are exchangeable — no time order, no shared entities — and when training k times is affordable.

Single holdout — one training set, one validation set, one number
Use it when

When the data has an arrow — time — so that only a forward split is honest, when training is expensive, or when the dataset is large enough that one held-out set already gives a tight estimate.

Dimensionk-fold — split the data into k parts, train k times, average the validation metricSingle holdout — one training set, one validation set, one number
Metric varianceLower — averaged over k estimatesHigher on small data, fine on large
Training costk runsOne run
Temporal dataLeaks unless rolled forward in timeHonest if the split is by time
Grouped dataLeaks unless folded by groupHonest if the split is by group
Simulates deploymentNo — every fold trains on some futureYes, if forward in time
Best forSmall, exchangeable data; model selectionLarge data; time-ordered data; final evaluation
Still needsA test set never used for selectionA test set never used for selection

Model families compared

Linear, trees, boosting, neural and k-NN — compared without naming a winner, and with the block that says where the comparison stops being true.

CONTESTED

No column is a winner. Each family is a set of assumptions about the data — linear separability, axis-aligned interactions, additive residuals, a representation that can be learned, locality in feature space — and the right one is the one whose assumptions your data happens to satisfy at the size you have. The reflex answer “XGBoost” is the red flag this table exists to catch: it is often right on tabular data and it is never right as a reflex, because it skips the baseline that would have told you whether anything more than a linear model was needed. The where this comparison misleads block on every row is the part worth reading.

Data size needed
Linear
Small. A few hundred rows estimate a handful of coefficients well; regularisation lets it survive more features than rows.
Trees
Moderate. A single tree is unstable on small data; a forest averages the instability away from a few thousand rows.
Boosting
Moderate to large. Needs a validation fold for early stopping on top of the training rows, and tunes badly on small data.
Neural
Large from scratch — orders of magnitude more than the others. Small if a pretrained network provides the representation.
k-NN
Small to moderate. Every stored example is the model; too few leaves gaps, too many makes prediction slow.
Where this comparison misleads

Count independent entities, not rows — a million events from ten thousand users is ten-thousand-sized data for generalising to new users. And the neural column flips completely with transfer learning: a pretrained model fine-tuned on two thousand images beats every other column on that task.

Tabular data
Linear
A strong baseline and often the final model when interactions are few or engineered by hand.
Trees
Strong without feature engineering; handles mixed types, thresholds and interactions natively.
Boosting
Usually the highest-quality single model on tabular data with a tuning budget and enough rows.
Neural
Competitive only with careful architecture and preprocessing; rarely worth it below hundreds of thousands of rows.
k-NN
Weak beyond a few dimensions and sensitive to scaling; fine as a baseline.
Where this comparison misleads

The "boosting wins on tabular" claim is true for a tuned model on tens of thousands of clean rows with a validation set. It is not true for three hundred rows, for a problem whose signal is linear, for a regulator who wants coefficients, or for a team with no time to tune — and the gap to the linear model is often inside the error bar.

Text, images, audio
Linear
Strong on bag-of-words text; useless on raw pixels or waveforms without a learned representation in front of it.
Trees
Cannot learn from raw pixels or tokens; usable on top of embeddings.
Boosting
Same as trees — a ranker or classifier on top of extracted features, not a feature learner.
Neural
The only family that learns the representation; pretrained networks make it the default for these modalities.
k-NN
Reasonable on top of pretrained embeddings with a good distance; useless on raw inputs.
Where this comparison misleads

The columns are not competing on the same input. Once a pretrained network has produced an embedding, a linear model or k-NN on top of it is often within a few points of full fine-tuning — so "neural for images" usually means "a neural representation, then whichever head is cheapest".

Interpretability
Linear
Coefficients are the model; sign, magnitude and confidence intervals can be shown and defended.
Trees
A shallow tree is a readable flowchart; a forest of five hundred deep trees is not.
Boosting
Opaque; importance and SHAP-style attributions are approximate and describe the model, not the world.
Neural
Opaque; attribution methods exist and disagree with each other.
k-NN
Transparent by example — "these five similar cases were positive" — which is sometimes exactly what a reviewer wants.
Where this comparison misleads

Interpretability is not one property. A linear model with two hundred correlated features and L1 selection is harder to explain honestly than a depth-three tree; and every column's "explanation" is undermined equally by a leaked or proxy feature, which the explanation will present with confidence.

Training cost
Linear
Seconds to minutes on a CPU, even for millions of rows.
Trees
Minutes; embarrassingly parallel across trees.
Boosting
Minutes to hours; sequential across rounds, plus a tuning search on top.
Neural
Minutes for a small head on a CPU; hours to weeks on accelerators for anything trained end to end.
k-NN
None — the training step is storing the data. The cost is deferred to prediction time.
Where this comparison misleads

Training cost is dominated by the number of runs, not the run: a boosted model tuned over two hundred configurations costs more than a network fine-tuned once. And the k-NN column's zero is a loan repaid on every query.

Inference latency
Linear
Microseconds; a dot product.
Trees
Fast per tree; hundreds of deep trees add up but stay well under a millisecond on a CPU.
Boosting
Similar to a forest; thousands of shallow trees is still sub-millisecond compiled.
Neural
From sub-millisecond for a small network to tens of milliseconds for a transformer; batching and hardware decide the cost.
k-NN
Grows with the stored set; needs an approximate index at scale, which trades recall for speed.
Where this comparison misleads

The model is rarely the slow part. Feature retrieval, a network hop and JSON serialisation usually dwarf any of these numbers, so a latency budget is a question about the serving path before it is a question about the family.

Feature engineering burden
Linear
High. Interactions, nonlinearities, bucketing and scaling must all be built by hand.
Trees
Low. Thresholds and interactions are learnt; scaling is irrelevant; categories need only a sensible encoding.
Boosting
Low, as for trees — but the features still have to be computed identically at serving time.
Neural
Low for raw modalities, where the network learns the features; high on tabular data, where scaling, encoding and architecture all matter.
k-NN
High. The distance is the model, so scaling and feature weighting decide everything.
Where this comparison misleads

A low burden on the modelling side does not remove the burden on the serving side: every column's features must be reproduced at prediction time with the same code, the same freshness and the same point-in-time semantics. Trees remove the need to engineer features, not the need to serve them.

Handling of missing values
Linear
Must be imputed, and the imputation is part of the model that ships.
Trees
Most implementations route missing values natively, learning which branch they belong to.
Boosting
Native handling in the common implementations; missingness becomes a signal.
Neural
Must be imputed or masked explicitly; the network will not do it for you.
k-NN
Must be imputed; a missing coordinate breaks the distance.
Where this comparison misleads

Native handling is convenient and dangerous in equal measure: it lets a tree model learn that "missing" predicts the target, which is fine until serving produces missingness for a different reason — a timeout, a new form — and the model reads the outage as a signal.

Calibration of outputs
Linear
Logistic regression is close to calibrated by construction, given the model fits.
Trees
Forest vote fractions are compressed toward the middle; not probabilities without calibration.
Boosting
Scores rank well and are typically miscalibrated, especially with class weighting or early stopping.
Neural
Often overconfident; calibration degrades with model size and with distribution shift.
k-NN
Neighbour vote fractions are coarse and depend on k; treat as ranks.
Where this comparison misleads

Calibration only matters if a downstream decision multiplies the score by a cost or compares it to a probability threshold; a pure ranker does not need it. And calibration measured on the validation set drifts with the base rate in production, for every column alike.

Extrapolation
Linear
Extrapolates linearly beyond the training range — confidently, and often wrongly.
Trees
Cannot extrapolate: a prediction outside the training range is the nearest leaf's value.
Boosting
Same as trees — flat beyond the range it saw.
Neural
Unpredictable outside the training distribution; may extrapolate smoothly or produce nonsense.
k-NN
Cannot extrapolate; returns the nearest stored examples.
Where this comparison misleads

Neither behaviour is "correct". A tree that predicts last year's maximum for a record-breaking day is wrong; a linear model that predicts a negative price is wrong differently. The honest answer is a monitor on inputs outside the training range and a fallback for them, whichever family serves.

Robustness to irrelevant features
Linear
Moderate with regularisation; a noisy feature gets a small coefficient, not zero, unless L1 is used.
Trees
Good; an uninformative feature is rarely chosen for a split.
Boosting
Good, with the same caveat — and it will find a weakly leaky feature faster than anything.
Neural
Poor without regularisation on small data; will use anything correlated with the target.
k-NN
Very poor; every irrelevant dimension dilutes the distance equally.
Where this comparison misleads

Irrelevant is not the danger — leaky is. Every column will seize a feature that carries the answer, and the more capable the model the more efficiently it does so; robustness to noise says nothing about robustness to leakage, which only a point-in-time audit provides.

When it is the wrong choice
Linear
When the signal is in interactions and thresholds nobody has engineered, or in raw pixels and tokens.
Trees
When the target extrapolates, when the data is tiny, or when a coefficient has to be defended.
Boosting
When there is no validation set to stop on, no time to tune, tiny data, or a regulator in the room. "XGBoost" as a reflex is the red flag, not the answer.
Neural
When the data is small tabular, when latency is a millisecond on a CPU, or when nobody can operate the training and serving infrastructure it needs.
k-NN
When the data is high-dimensional and unscaled, when the stored set is large, or when prediction latency matters.
Where this comparison misleads

Every column is wrong somewhere, and the question that finds where is the same for all of them: how much data, of what modality, at what latency, with what interpretability requirement, judged by which metric, at what cost to train and serve. A model family chosen before those are answered is a guess with a library name.