A way out

A Median Escape

Three learned predictors. One calm majority.

A median of three learned predictors can predict well on both old and fresh inputs, even when each of the three misfits its own training points. The predictors are learned; the nonlinear rule that combines them, the median, is handcrafted.

If you landed here first: with few examples, good prediction can require misfitting the training data, for any predictor that is a weighted sum of the training inputs (the training span). Here is an escape.

The learned experiment

A median can change the report card.

Split the training points into three piles and learn one predictor from each. At a training point, its own predictor may scream. The other two never saw that point: their votes can give the median a calm majority.

Medians are a familiar defense against outliers. Here, the data are clean. A training point can still be an outlier to the very predictor it helped train.

Pick a training point. Count the votes.

Each pile learns a matched filter, a span predictor: add up its training inputs’ feature vectors, each weighted by its label, then rescale. Inputs here are real numbers lifted to Fourier features, not the Core Story’s Gaussian vectors, so each predictor is linear in its feature vector without being a straight line in the scalar input. The median combines the three predictions nonlinearly. Every label is 1, so the target is the flat line at 1. Select a training point to compare the votes.

Two nearby inputs from different piles can make two predictors overshoot together. Start with Show the median’s worst training point, then try another draw to see when that defeats the median.

We use the constant target 1 to make the voting easy to see. The pile learners receive examples and feature vectors; telling them the target is constant would let them solve this example by always predicting 1.

The learned-curve experiment has not loaded. Each matched-filter pile predictor overshoots its own training points, while the other two predictions usually shield the median.

How are these curves learned?

A fixed Fourier feature map supplies the shared signal and nuisance.

This finite feature illustration draws 36 training inputs independently and uniformly from [0, 1), the same law as the fresh inputs, and splits them at random into three disjoint piles of 12. The target is 1. Each input has one shared signal coordinate of strength γ = 30 and 1,296 Fourier nuisance coordinates. Thus the feature count is d = 1,297, and each pile has m = 12 examples.

Each pile predictor is the matched filter: add the pile’s training inputs, each weighted by its label, and divide by γ times the sum of the squared labels: uk = Σi∈Ik yixi / (γ Σi∈Ik yi2). With every label equal to 1, that is the pile’s sum of inputs divided by 30 × 12. Besides the pile itself, the rule uses only the known signal strength.

Why the median stays accurate on training points: at a point in one pile, the other two piles’ predictions are fresh predictions, because those piles never saw that point. The median lies between them, so its squared error there is at most the sum of their two squared errors. Each pile’s expected fresh error is (d−1)/(γ2m) = 1296/(900 × 12) ≈ 0.12, so averaged over draws the median’s training and fresh errors are each at most about 0.24. The stylized paper places the inputs on an evenly spaced grid, which makes the nuisance vectors exactly orthogonal and the median’s training error exactly zero. Independent draws trade that exact zero for a small average.

Does shielding training points also protect against adversarial perturbations?

Not automatically. This median avoids the training-loss obstruction, but this estimator still inherits its linear constituents’ sensitivity to a Euclidean nuisance perturbation of RMS size δ per coordinate. The adversarial example in the stylized model shows the same budget: ‖Δ‖₂ ≤ δ√(d−1), with the signal coordinate fixed.

Why does this escape the linear training-loss obstruction?

For the single-spike iid Gaussian model with noiseless labels, consider n examples, d features and signal variance γ in the regime (d−1)/γ² ≪ n ≪ (d−1)/γ. This is the Gaussian counterpart of the Fourier illustration above.

Linear span: good test error requires bad training error

With probability tending to 1 over the training draw, every span predictor within a fixed factor of the best test error…

Etest ≲ (d−1)/(γ2n)

…has training error at least
Ltrain ≳ (d−1)2/(γ2n2)

Median of three: outside the linear class

Split n = 3m into three fixed groups of m > 2 before observing the data. Each matched filter learns from one third of the examples, so accurate other-pile votes still need enough data. It uses the supplied γ.

E[Etest] = O((d−1)/(γ²n))

E[Ltrain] = O((d−1)/(γ²n))

The median’s two expectations, taken over training draws, are each at most 2(d−1)/(γ²(m−2)). Thus average training error and fresh-test error vanish in probability. The guarantee concerns these average errors, rather than the worst training point.

Each training point can get its answer from the two predictors that never saw it: whatever its own predictor says, the median lies between their two votes, so it misses the target by no more than the worse of them. That is how the median escapes the linear training-loss obstruction. A nonlinear model can represent this combining rule internally, too: three ReLU units suffice.