Why There Can Be More Than One Reasonable Penalty
Cross-validation compares candidate penalty values by measuring prediction error on observations not used to fit each fold-specific model. The penalty with the smallest average error is a direct choice if the sole aim is to minimize the observed cross-validation error. But small differences in those averages can be unstable: another set of folds might produce a slightly different ordering. The one-standard-error rule offers a conservative alternative. It treats penalties with errors close to the minimum as practically competitive, then favors stronger shrinkage among them.
This is a choice between two tuning criteria, not a claim that one penalty is universally best. The minimum-error choice prioritizes the smallest observed cross-validation loss. The one-standard-error choice accepts a loss that is within a specified margin of that minimum in exchange for a larger penalty, which generally shrinks coefficients more strongly. For lasso, stronger shrinkage often also means fewer nonzero coefficients; for ridge, it reduces coefficient magnitudes but does not ordinarily set them exactly to zero.
Calculating the Threshold
Suppose \(K\)-fold cross-validation produces fold losses \(L_1(\lambda),\ldots,L_K(\lambda)\) for a candidate \(\lambda\). In the common simple calculation, their mean is the cross-validation error and their sample standard deviation divided by \(\sqrt K\) estimates its standard error:
Here \(s_L(\lambda)\) is the sample standard deviation of the \(K\) fold losses. The one-standard-error rule uses \(SE(\lambda_{\min})\), the estimated standard error at the minimum-error candidate, to set the threshold. It does not add a separate standard error to every candidate's loss. Implementations and cross-validation designs can estimate uncertainty differently, so the calculation method should be stated when results are reported. The examples here use this common fold-based calculation.
A short justification clarifies what the calculation does and does not say. If the fold losses are viewed as \(K\) values whose average estimates the cross-validation error, their sample standard deviation describes their observed spread. Dividing by \(\sqrt K\) estimates the standard error of that average under the usual independent, comparable-replicate calculation. This is a useful summary of variation across folds, but folds share much of their training data; therefore this estimate is not a guarantee of precise uncertainty quantification or a formal test of equal predictive performance.
The direction of the choice matters. The rule selects the largest qualifying \(\lambda\), not the smallest one. In ridge and lasso regression, increasing \(\lambda\) increases the penalty and generally strengthens shrinkage. The choice is made from the candidate grid that was evaluated: it does not imply that an untested penalty has been checked.
Worked Example: Finding the Largest Qualifying Penalty
Suppose five-fold cross-validation gives the following mean losses on a fixed candidate grid. Assume all candidates used the same folds and the same loss measure.
| Candidate \(\lambda\) | Mean cross-validation loss |
|---|---|
| 0.01 | 11.40 |
| 0.1 | 10.20 |
| 1 | 9.79 |
| 10 | 9.72 |
| 100 | 9.84 |
The minimum mean loss is 9.72, at \(\lambda_{\min}=10\). Suppose the five fold losses at this candidate are 9.2, 9.8, 10.1, 9.5, and 10.0. Their mean is
The deviations from 9.72 are \(-0.52, 0.08, 0.38, -0.22,\) and \(0.28\). Thus the sample variance and standard deviation are
The estimated standard error is \(0.3701/\sqrt{5}\approx 0.1655\), so the threshold is \(9.72+0.1655=9.8855\). The candidates with mean loss no greater than 9.8855 are 1, 10, and 100. Therefore \(\lambda=100\) is the one-standard-error choice: it is the largest qualifying candidate on the listed grid. The minimum-error choice remains \(\lambda=10\).
What the Two Choices Trade Off
The minimum-error penalty optimizes the observed average loss among the candidates tested. It may be preferable when prediction performance is the main priority and the minimum is meaningfully lower than the alternatives. But it can also be a relatively weak penalty selected because of small fluctuations in fold losses. The one-standard-error choice is deliberately more regularized when a larger candidate remains within the threshold. That may yield a simpler lasso fit or stronger coefficient shrinkage, while accepting a cross-validation loss that is close to the observed minimum.
“Close” here has a specific operational meaning: the difference in mean cross-validation loss is at most the estimated standard error used in the rule. It does not mean the two models have been proved equivalent, nor does it establish that their future prediction errors will differ by no more than that amount. Cross-validation estimates performance for a specified loss and validation design; the selected penalty depends on those choices.
Worked Example: A Lasso Choice With Fewer Active Predictors
A hypothetical lasso analysis evaluates the candidate penalties in the table below. The reported active-predictor count is the number of fitted coefficients that are nonzero at that candidate. Suppose the five fold losses at \(\lambda=0.1\), the minimum-error candidate, are 4.8, 5.0, 5.2, 4.9, and 5.1.
| \(\lambda\) | Mean cross-validation loss | Nonzero predictors |
|---|---|---|
| 0.05 | 5.12 | 18 |
| 0.1 | 5.00 | 14 |
| 0.2 | 5.03 | 10 |
| 0.4 | 5.06 | 6 |
| 0.8 | 5.09 | 3 |
The losses at \(\lambda=0.1\) average to \(25.0/5=5.00\). Their deviations from the mean are \(-0.2, 0, 0.2, -0.1,\) and \(0.1\), giving
The one-standard-error threshold is \(5.00+0.07071=5.07071\). The largest candidate not exceeding it is \(\lambda=0.4\), with mean loss 5.06; \(\lambda=0.8\) does not qualify because its loss is 5.09. On this grid, the minimum-error fit has 14 nonzero predictors, while the one-standard-error fit has 6. The latter is more sparse in this example, but its cross-validation loss is 0.06 higher. That is an observed tradeoff, not proof that either fit will be better on future data.
Apply the Rule to the Candidate Grid
The one-standard-error rule does not require the cross-validation curve to decrease smoothly on one side of the minimum and increase smoothly on the other. Fold variation can make nearby values rise and fall. The rule is therefore best applied by calculating the threshold, comparing every candidate with it, and choosing the largest candidate that qualifies. Do not infer eligibility merely from the position of a candidate next to the minimum.
Worked Example: Checking Every Candidate on a Nonmonotone Curve
Suppose the minimum mean cross-validation loss is 12.32 at \(\lambda=2\). Its five fold losses are 11.8, 12.1, 13.0, 12.5, and 12.2. Their sum is 61.6, so their mean is \(61.6/5=12.32\). The deviations are \(-0.52,-0.22,0.68,0.18,-0.12\); hence
The threshold is \(12.32+0.2035=12.5235\). Compare it with every candidate:
| \(\lambda\) | Mean cross-validation loss | At or below 12.5235? |
|---|---|---|
| 0.5 | 12.60 | No |
| 1 | 12.45 | Yes |
| 2 | 12.32 | Yes |
| 4 | 12.50 | Yes |
| 8 | 12.48 | Yes |
| 16 | 12.70 | No |
Although the candidate at \(\lambda=16\) is beyond the threshold, \(\lambda=8\) qualifies. The largest qualifying candidate is therefore \(\lambda=8\), not \(\lambda=4\) and not 16. This illustrates why the rule calls for checking the full tested grid rather than assuming that qualifying candidates form a continuous interval.
Interpreting and Reporting the Decision
The rule is a practical selection convention, not a hypothesis test. It does not define \(H_0\) and \(H_a\), use a significance level \(\alpha\), or yield a p-value. In particular, being within one standard error is not evidence that two penalties have identical predictive performance. Nor is the standard error a confidence interval for the penalty parameter. It summarizes estimated variation in the cross-validation loss according to the calculation used.
A clear report names both choices and provides enough information to reconstruct the decision: the candidate grid, the loss measure, the minimum cross-validation loss and its penalty, the estimated standard error at that minimum, the resulting threshold, and the largest qualifying penalty. For the one-standard-error choice, it is also useful to describe the resulting model's degree of shrinkage or, for lasso, its number of nonzero coefficients. Do not call a larger-\(\lambda\) fit “better” without saying in what sense: it may be simpler, while its observed mean loss may be slightly higher.
Common Mistakes
- Choosing the smallest qualifying penalty. The one-standard-error rule chooses the largest qualifying \(\lambda\), because larger penalties generally impose stronger shrinkage.
- Adding the standard error to every candidate's loss. The stated rule uses the standard error estimated at \(\lambda_{\min}\) to set one threshold for all candidate mean losses.
- Assuming the cross-validation curve is monotone away from its minimum. Fold variation can produce nonmonotone values, so compare every candidate directly with the threshold.
- Calling the rule a significance test or proof of equal performance. It is a tuning convention based on an estimated error margin, not a test of a null hypothesis.
- Reporting a penalty not on the grid as the result. The rule selects among evaluated candidates; it does not establish that untested values meet the threshold.
Check Your Understanding
Answer each question using the definitions and calculations in this tutorial.
- A candidate grid has minimum mean cross-validation loss 18.4 at \(\lambda=3\), with \(SE_{\min}=0.6\). What is the one-standard-error threshold?
- If candidates \(\lambda=5, 10,\) and \(20\) have mean losses 18.8, 18.9, and 19.2, respectively, which is the one-standard-error choice under the threshold in Question 1?
- Why does the one-standard-error rule use the standard error at the minimum-error candidate rather than adding a separate standard error to each candidate's mean loss?
- Explain why a one-standard-error choice is not proof that its future prediction error equals that of the minimum-error choice.
- For lasso, what tradeoff might arise when the one-standard-error choice has a larger \(\lambda\) than the minimum-error choice?