ATLAS NOVA My AtlasVelocer ↗

Concept · Machine learning

Regularization (machine learning)

Machine learning technique

Regularization (machine learning) is the general name for any technique that deliberately limits a model's freedom to fit its training data, so that what it learns carries over to data it has never seen.

Left to itself, a sufficiently flexible model will do this too well: it will fit not only the pattern that links inputs to outputs but also the accidental quirks of the particular examples, and then fail on new cases. The aim is not to make the model worse on the training set but to make it better on everything else.

Key facts
84.0Mean EEG decoding accuracy for deep ConvNets versus 82.1 percent for FBCSP (Schirrmeister et al., 2017)⁠[1]
5570Fleckvieh bulls genotyped at 50,000 SNPs for milk fat content (Waldmann et al., 2013)⁠[2]
3000Simulated progeny in QTL-MAS 2011 breeding-value comparison of six penalized methods (Ogutu et al., 2012)⁠[3]

Overview

Regularization (machine learning)

A concrete picture helps. Suppose a model must predict a numeric outcome from a handful of measurements, and the training set is small. An unconstrained fit can thread itself through every training point, assigning large weights to measurements that happen to correlate with the outcome by chance. On the training data the error is nearly zero; on fresh data the same weights amplify noise and the error is large. The model has memorized rather than learned. Regularization pushes back against this by making complexity costly, so a fit that relies on many large, finely tuned weights is penalized relative to a simpler one that captures the main trend.

A conceptual graph shows squared bias rising, variance falling, constant noise and a U-shaped total error curve beside an equation, a numeric table and three numbered explanations.
Regularization balances rising squared bias against falling variance to reduce expected prediction error. The curves and table values are illustrative. View full-size image.The Bias Variance Tradeoff by Atlas Nova. Illustration generated with AI for this article and checked against its text.

The tension has a standard name. A model's expected error on new data can be decomposed into bias, the error from assumptions that are too rigid, and variance, the error from sensitivity to the particular training sample. A very flexible model has low bias and high variance; a very rigid one has the reverse. Regularization moves a model along this tradeoff toward higher bias and lower variance, and the right amount is the one that minimizes total error, not the one that minimizes training error. This is why a regularized model can post a worse training score and still be the better predictor.

The idea takes many concrete forms, and the word covers techniques that work in quite different ways. One family adds a penalty term to the quantity the model minimizes, a charge for large parameter values that pulls them toward zero; the strength of that charge is set by a tuning parameter, and the specific penalties and what they do to individual coefficients are taken up later. Another family injects randomness during training, for example by randomly disabling units of a neural network so that no single unit becomes indispensable. Others act on the data, generating altered copies of training examples so the model cannot rely on incidental details, or on the training schedule, halting training before the model has had time to memorize. A systematic taxonomy of the field sorts these methods by whether they affect the data, the network architecture, the error term, the regularization term, or the optimization procedure.⁠[4] The unifying purpose is the same in every case: constrain the fit so that it generalizes.

The framing in terms of controlling complexity to prevent overfitting and improve generalization is the standard one in reviews of regularized machine learning for genetic prediction, which treat model regularization and rigorous validation as the two factors on which predictive applications depend.⁠[5] Tutorial treatments make the same connection explicit, presenting overfitting, cross-validation and regularization as one chain of ideas and working through penalties, weight decay, noise injection and early stopping as instances of it.⁠[6] What differs between the instances is the mechanism, and later sections take up each family in turn, along with the evidence on when each one helps.

Regularization trades a little accuracy on the training data for reliability on new data; the tuning parameter decides how much of that trade to make.

History

Where the idea came from

The statistical roots of regularization lie in ordinary regression, where a model predicts a numeric outcome as a weighted sum of predictor variables. When predictors are few and samples are many, the standard least-squares solution works well. When predictors are numerous and samples few, it breaks down: the weights become unstable, sensitive to tiny changes in the data, and the model fits noise.

Robert Tibshirani.
Robert Tibshirani. View full-size image.Robert tibshirani by Tibshirani. CC BY-SA 3.0, via Wikimedia Commons. Scaled to 917 pixels wide; no crop or other changes by Atlas Nova.

One remedy is ridge regression, which estimates the regression coefficients through an ℓ2-norm penalized least-squares criterion. The penalty is an L2 norm. Its effect is to shrink the coefficients of correlated predictors toward each other, allowing them to borrow strength from each other. Ridge regression tends to favor models that depend on all the variables, so it keeps every predictor in the model.⁠[2]

A different penalty was proposed by Tibshirani in 1996: the lasso, which penalizes the sum of the absolute values of the coefficients rather than their squares.⁠[2] This is an L1 norm, and its consequence is qualitatively different. The L1 penalty exerts the same force on all non-zero coefficients, and the lasso enables variable selection such that only the important predictor variables stay in the model.⁠[2] The lasso therefore performs variable selection as part of fitting, not as a separate step. For a geneticist faced with many more markers than samples, the lasso's variable selection was relevant: only the important predictor variables stay in the model.⁠[2]

The lasso has known weaknesses that motivated the next development. When predictors are highly correlated, as genetic markers often are, the lasso tends to select one member of a correlated group and discard the rest, and in the extreme case of identical predictors it breaks down entirely. It also cannot select more predictors than there are samples, a real constraint when the number of markers vastly exceeds the number of individuals.⁠[2]

Ridge regression handles correlated predictors gracefully but never produces a sparse model. Zou and Hastie proposed the elastic net, which combines both penalties under a mixing parameter that sets the balance between the L1 and L2 terms. The elastic net with α set to 0 is equivalent to ridge regression; with α close to 1 it performs much like the lasso but removes any degeneracies and odd behavior caused by high correlations.⁠[2] The elastic net was designed to keep the lasso's variable selection while borrowing ridge regression's tolerance for correlated predictors.

Later work extended the lasso in many directions, including the adaptive LASSO, elastic net, and group LASSO.⁠[7] Regression coefficients are shrunk by imposing a penalty on their size, done by adding a penalty function to the least-squares model, with a regularization parameter λ.⁠[2] That structure is what allows the same idea to travel from regression to other kinds of model, and it is the subject of the next section.

Ridge shrinks, the lasso selects, and the elastic net does both; each was invented to solve a specific failure of plain regression when predictors outnumber samples.

Main ideas

Penalties, shrinkage and variable selection

The penalty term is the most studied form of regularization, and its logic is easiest to see in a linear model. Such a model predicts an outcome as a weighted sum of predictor variables, and fitting it means choosing the weights. Ordinary least squares chooses the weights that minimize the squared gap between predictions and observed outcomes. A penalized fit minimizes that same squared gap plus a charge for the size of the weights, so a model can only buy a better fit by paying for larger coefficients. The charge is multiplied by a tuning parameter, usually written as lambda, which sets the exchange rate between fit and simplicity. Raise lambda and the weights shrink; lower it and the model is free to fit harder. This is the structure that turns a fitting problem into a regularization problem, and it is the same structure whether the model is a regression or something more elaborate.⁠[7]

What the penalty charges for determines what the fit does, and the two standard choices behave very differently. An L2 penalty charges for the sum of the squared weights. Because squaring makes large weights disproportionately expensive, the L2 penalty pushes every coefficient toward zero, and it pushes hardest on the ones that are largest. It also has a distinctive effect on predictors that carry overlapping information: their coefficients are pulled toward each other, so correlated variables end up sharing the explanatory burden instead of one of them taking a large value while the others sit near zero.⁠[2] The result is a model that uses all of its predictors, each with a modest weight. Nothing is ever removed.

An L1 penalty charges for the sum of the absolute values of the weights. The difference in shape matters more than it might appear. The L1 charge is proportional to a coefficient's size, so a small coefficient pays a small price, but that price is enough to make it not worth keeping if the coefficient contributes little to the fit. The penalty therefore drives weak coefficients all the way to zero, and the fitted model ends up depending on a subset of the predictors.⁠[2] This is variable selection performed as part of fitting rather than as a separate step: the model does not merely downweight the unhelpful variables, it discards them. For a problem with far more candidate predictors than samples, that is a substantial practical difference, because the fitted model returns a short list rather than a long one.

The two penalties also differ in how they treat the coefficients that matter most. The L1 penalty applies the same force to every non-zero coefficient regardless of its size, so a variable that clearly belongs in the model is shrunk less than it would be under L2.⁠[2] This is part of why the lasso can be a better selector than ridge regression, and part of why ridge regression is the better choice when nearly every predictor carries some real signal. The choice between them is a statement about what kind of answer is wanted: a sparse list of named variables, or a stable weighted combination of all of them.

Neither penalty is without costs, and the elastic net was designed to address the lasso's. When predictors are highly correlated, the lasso tends to keep one member of a correlated group and set the others to zero, and with exactly identical predictors it breaks down altogether; it also cannot select more predictors than there are samples.⁠[2] The elastic net combines both penalties, with a mixing parameter, usually written as alpha, that sets the balance between the L1 and L2 terms. At one end of the scale the elastic net is ridge regression; near the other it behaves much like the lasso but without the erratic behaviour that high correlation provokes.⁠[2] The L2 component gives correlated predictors a way to share weight, while the L1 component still produces a sparse model. The mixing parameter is a second dial alongside lambda, and it decides how much of the lasso's selectivity to keep.

The family has grown well beyond these three. Adaptive versions adjust the penalty applied to each coefficient, so that important variables are penalized less than marginal ones, and group penalties select or discard blocks of predictors together rather than one at a time.⁠[7] What all of them share is the same skeleton: a loss that measures fit, a penalty that measures complexity, and one or more tuning parameters that set the price of complexity. That skeleton is what lets the idea travel from linear regression to other kinds of model, and it is why a single framework can describe methods that look quite different on the surface.

One consequence of the skeleton deserves emphasis because it recurs wherever penalties are used. Shrinking coefficients toward zero introduces bias: the fitted weights are systematically smaller than the ones that would best describe the underlying relationship, so the model's estimates are wrong on average even before any noise is considered. The compensation is that the estimates have smaller variance, meaning they move less from one training sample to the next, and the total error, which combines both, can fall.⁠[2] A penalized model is therefore deliberately imperfect on the data it was fitted to. The tuning parameter decides how much imperfection to accept, and setting it well is a problem in its own right, taken up later.

The two penalties differ in whether they remove predictors or only shrink them.

Regularization beyond penalties

Penalties act on the weights a model ends up with. A second family of techniques acts instead on the process of training, and its members are best understood as different ways of injecting noise or constraint into that process so the model cannot settle into a solution that depends on incidental detail. The unifying taxonomy of the field sorts regularization methods by what they touch: the data, the network architecture, the error term, the regularization term, or the optimization procedure.⁠[4] Penalties belong to the fourth group. The methods below belong mostly to the first and fifth.

Two neural network diagrams side by side, labeled "Regular Connections" on the left and "Applying Dropout" on the right, with the dropout version showing some nodes and connections removed.
Two neural network diagrams side by side, labeled "Regular Connections" on the left and "Applying Dropout" on the right, with the dropout version showing some nodes and connections removed. View full-size image.Dropout mechanism by Daniel Voigt Godoy. CC BY 4.0, via Wikimedia Commons. Scaled to 960 pixels wide; no crop or other changes by Atlas Nova.

Dropout is the clearest example of noise injected into a network's internal workings. During training, units of the network are randomly switched off on each pass, so that any given unit cannot count on its neighbours being present and cannot become indispensable to the output. The effect is that the network learns redundant, distributed representations rather than a fragile chain in which one unit carries a crucial signal. At prediction time the units are all switched back on, and the network behaves as an ensemble of the many thinned networks seen during training. Dropout is one of the standard regularizers in deep learning, and it is often combined with other techniques rather than used alone.

Weight decay looks superficially like an L2 penalty, and in the simplest optimizers the two coincide. They are not the same thing in general. An empirical investigation of weight decay across three optimization algorithms (plain stochastic gradient descent, Adam, and a second-order method) and a range of architectures identified three distinct mechanisms by which it exerts its regularizing effect, depending on the algorithm and architecture: it can increase the effective learning rate, it can approximately regularize the norm of the network's input-output Jacobian, and it can reduce the effective damping coefficient in second-order optimization. The traditional reading of weight decay as nothing more than L2 regularization is therefore incomplete, and the authors found that literal weight decay outperformed L2 regularization for optimizers in which the two differ.⁠[8] The practical lesson is that a technique's name does not fully specify what it does; the optimizer it is paired with matters.

Early stopping constrains training through time rather than through the model's parameters. A flexible network trained to convergence will eventually begin to fit the noise in its training set, and its error on held-out data will start to rise even as its training error continues to fall. Stopping before that point keeps the model at a stage where it has captured the main structure but not the accidents. The number of training steps becomes a tuning parameter in its own right, and the point to stop is found by watching performance on data the model is not being fitted to. Tutorial treatments present early stopping alongside penalties, weight decay and noise injection as one of the standard instances of regularization.⁠[6]

Batch normalization is a technique for stabilizing and speeding training that also carries a regularizing side effect. It rescales the inputs to each layer during training using statistics computed over the current batch of examples, which keeps the scale of activations within a workable range. Because those batch statistics vary from one batch to the next, the network sees slightly different inputs on each pass, which introduces a mild noise that has a regularizing effect. In a study of convolutional networks trained to decode imagined or executed movements from raw EEG recordings, batch normalization and exponential linear units were among the design choices that proved crucial for reaching high decoding accuracy, and the deep ConvNets reached mean accuracies of 84.0 percent against 82.1 percent for the established filter bank common spatial patterns method. The same study found that the improvements from these techniques were most pronounced for the deep network on a restricted frequency band, a setting in which the networks could easily overfit.⁠[1]

Data augmentation regularizes by enlarging the training set with altered copies of existing examples. The alterations are chosen so that they preserve the label: a rotated photograph of a cat is still a photograph of a cat, and a sentence with a synonym swapped usually keeps its meaning. A model trained on such copies cannot rely on the precise form of any single example, because the same underlying pattern appears in many guises. In text, augmentation is harder to design than in images, because it is much harder to say in general which transformations preserve meaning, and a survey of the area describes augmentation as a regularization strategy that complements dropout and weight penalties by expressing semantic invariance directly. The survey also notes that without augmentation or regularization more generally, deep networks are prone to learning spurious correlations and memorizing high-frequency patterns that are difficult for humans to detect.⁠[9]

A more recent variant smooths the model's outputs rather than its inputs. Virtual adversarial training defines a measure of local smoothness of the label distribution: it asks how much the model's predicted probabilities change when its input is perturbed in the direction that would most change them, and then trains the model to be robust to that perturbation. The adversarial direction is computed without using the true label, which makes the method applicable to semi-supervised learning, where most examples carry no label at all. The computational cost is modest, requiring no more than two pairs of forward and backward passes to approximate the gradient of the loss.⁠[10] The idea behind it is that a good model should not change its answer wildly in response to a tiny change in its input, and enforcing that stability is itself a form of constraint on what the model can learn.

These methods differ widely in mechanism, but they share the logic set out at the start of the chapter. Each one makes some part of the fitting problem harder than it would otherwise be, whether by removing units, charging for weight, halting training, rescaling activations, multiplying examples, or demanding stability of predictions. The tuning parameter that sets the strength of a penalty has its counterpart in each case: the dropout rate, the weight decay coefficient, the number of training steps, the augmentation budget. How to set such a parameter well is the subject of the next section.

Penalties constrain the weights a model can reach; dropout, early stopping, augmentation and smoothing constrain the path it takes to get there.

Research

Choosing the strength: validation and cross-validation

A regularized model has a dial, and the dial has to be set. The penalty strength, the mixing weight between L1 and L2 charges, the point at which training stops: each of these is a hyperparameter, meaning a setting chosen by the person building the model rather than learned from the training data.⁠[11] The training data cannot decide its own penalty, because the fit that minimizes error on the data it was fitted to is always the one with no penalty at all. Something outside the fitting process has to judge which setting will do best on cases the model has not seen.

Holding data back

The simplest answer is to split the data. One portion, the training set, is used to fit the model at each candidate setting of the dial; another portion, the validation set, is used only to score the resulting model. The setting that scores best on the held-out portion is kept. This is the logic behind the holdout method, in which samples are partitioned into separate training and test sets, and behind random sampling, which repeats that split several times with different random assignments to better estimate the accuracy.⁠[12] The catch is that holding data back costs training data, which is painful when samples are scarce, and a single split gives a noisy verdict.

Cross-validation recovers most of that loss. In k-fold cross-validation the data are divided into k parts; the model is fitted on k−1 of them and scored on the part left out, and the procedure rotates through all k parts so that every sample is used for training several times and for testing once. The scores from the k rounds are averaged, and that average is the estimate attached to a given setting of the dial.⁠[12] The parameter k is commonly set to 5 or 10. Searching over a grid of candidate settings and keeping the one with the best cross-validated score is called model selection.⁠[11]

Cross-validation is also the natural place to set the penalty in a penalized regression. Fitting a lasso or elastic net across a range of values of the tuning parameter produces a whole path of models, from heavily penalized to barely penalized, and cross-validation scores each point on that path. The value of lambda with the lowest cross-validated error is one obvious choice. A second, more cautious choice is the largest lambda whose error is still within one standard error of that minimum, written as minMSE + 1SE.⁠[2] The two criteria do not have to agree, and the difference between them turns out to matter for what kind of model results.

When the lowest error is the wrong target

A comparison of the lasso and the elastic net in genome-wide association data makes the point concretely. The setting is one where the number of genetic markers vastly exceeds the number of individuals, so the model must choose a small set of markers from tens of thousands of candidates. Tuning by minMSE + 1SE reversed the failure: the lasso produced no false positives at all, but picked up too few of the correct markers.⁠[2] Neither criterion gave the answer a geneticist would want, and the reason is that the two goals being asked of the model, predicting well and naming the right variables, are not the same goal.

But that same value of the mixing parameter never produced the lowest cross-validated error, which means a search that tuned both dials by minimizing error would have walked past the setting that selected best. The practical conclusion drawn was that an alternative tuning criterion is needed when the aim is variable selection rather than prediction.⁠[2] Cross-validation answers the question it is asked, and if it is asked only about prediction error, it will not necessarily return the model that identifies the right variables.

The bias hidden in the procedure

There is a subtler problem, and it concerns the validation procedure itself rather than the criterion. Cross-validation is only honest if the data used to score a model played no part in building it. When the whole modelling pipeline, including steps like feature selection, is run inside each fold, that separation holds. When some step is performed once on all the data before the folds are drawn, information from the test portion leaks into training, and the resulting score is optimistic.

The size of that optimism was measured directly. Using synthetic data with no real signal, where any classifier should score at chance, a simulation study varied the sample size and the validation method and recorded how far the reported accuracy drifted above 50 percent. Nested cross-validation, in which an inner loop selects settings and an outer loop estimates performance, gave unbiased estimates regardless of sample size, as did a simple train/test split.⁠[13] The lesson is that the dial must be set inside the protected loop, not outside it.

The same study offers a reason to distrust a whole literature. Smaller studies reported better results, which is the signature of validation that has not fully controlled overfitting rather than of smaller studies being better science. None of this means the individual studies were fraudulent; it means the estimating procedure, not the underlying signal, was doing some of the work.

For the person setting a penalty, the practical upshot is a short list of habits. Separate the data that scores a model from the data that builds it, all the way down to the feature selection step. Prefer nested cross-validation when samples are few and candidates are many. And decide in advance whether the model is wanted for prediction or for selection, because the tuning criterion that serves one may not serve the other. The remaining sections take up what the evidence shows in particular fields, how regularization is used in deep networks, and where the whole approach runs into trouble.

Cross-validation tells the truth only about the question it is asked, and only if every choice was made inside the loop.

The k rounds rotate so every sample is tested once and used for training several times, and the scores are averaged.

What the evidence shows in genomics and breeding

The problem the penalties were built for

The image shows a diagram linking labeled ear features and an ear photo to a Manhattan plot of genome-wide association p-values across chromosomes, with SNP identifiers such as rs17023457 and rs1619249 marked.
The image shows a diagram linking labeled ear features and an ear photo to a Manhattan plot of genome-wide association p-values across chromosomes, with SNP identifiers such as rs17023457 and rs1619249 marked. View full-size image.Genome-wide associations of pinna traits by Kaustubh Adhikari, Guillermo Reales, Andrew J. P. Smith, Esra Konka, Jutta Palmen, Mirsha Quinto-Sanchez, Victor Acuña-A. CC BY 4.0, via Wikimedia Commons. Scaled to 946 pixels wide; no crop or other changes by Atlas Nova.
Figure 1. Pearson correlation with the true genomic value by model. Prediction accuracy of six regularized regression models on simulated genomic data, measured as the Pearson correlation between predicted genomic breeding values and the true genomic value. The source states: “Elastic Net 0.5071 0.4486 0.5308 0.9233 0.8659 2.2276 3.4618 Lasso 0.5062 0.4466 0.5293 0.9240 0.8705 2.1642 3.5478 Adaptive Lasso 0.4951 0.4454 0.5152 0.9195 0.8759 2.0757 3.9911 RR 0.4717 0.4050 0.5037 0.8246 0.8213 2.9046 3.3767 RR-BLUP 0.4628 0.3905 0.4951 0.8455 0.8315 2.9894 3.6487 Adaptive Elastic Net 0.4285 0.4013 0.4667 0.8968 0.8112 2.3404 4.2325” (Ogutu et al. (2012)).⁠[3]

A genome-wide association study measures genotypes at anywhere from some thousands to several millions of single nucleotide polymorphisms, or SNPs, the single-letter positions in the genome where individuals differ, in a number of subjects usually in the thousands.⁠[2] The task is to relate those genotypes to a trait, whether a disease status or a measured quantity such as milk fat content. The arithmetic is unforgiving: far more candidate predictors than samples, and the predictors themselves are correlated, because neighbouring SNPs tend to be inherited together. That correlation is called linkage disequilibrium, and it means the data contain many near-duplicates of the same signal.

The conventional analysis attacks this one SNP at a time, testing each marker separately for association and then correcting the significance threshold for the number of tests performed. The correction controls false positives but introduces false negatives, so genuine associations of moderate or small effect get discarded.⁠[2] A penalized regression takes the opposite approach, fitting all the markers jointly and letting the penalty decide which ones keep a non-zero weight. A penalized regression such as the lasso enables variable selection, so only the important predictor variables stay in the model.⁠[2]

What the lasso and elastic net actually selected

A direct comparison of the lasso and the elastic net in this setting shows that the choice of penalty changes the answer, not just its precision. On simulated data built to mimic linkage disequilibrium, with 25 genuinely influential predictors hidden among 50,000 candidates, the tuning criterion mattered as much as the method. Selecting the penalty strength by the minimum cross-validated error picked up an excessive number of false positives under all three correlation settings tested, and the lasso and some elastic net variants began to overfit without recovering the right number of true predictors. Switching to the more cautious criterion, the largest penalty whose error stays within one standard error of that minimum, removed the false positives but swung too far: the lasso then selected too few of the correct markers.⁠[2]

The elastic net found a better balance. With its mixing parameter set around 0.1, weighted mostly toward the lasso's L1 penalty but retaining some of ridge's L2 tolerance for correlation, it missed no true predictors and produced no false positives in the high and low correlation settings, and missed only a few in the mixed setting. The awkward part is that this same setting never produced the lowest cross-validated error, so a search that tuned both dials purely by minimizing prediction error would have passed it by. The authors concluded that an alternative tuning criterion is needed when the goal is variable selection rather than prediction.⁠[2] The episode is a clean illustration of a general point: cross-validation reports on the question it is asked, and prediction error and correct variable identification are different questions.

The same pattern appeared on data simulated under more biologically complex conditions, where the true number of associated markers was not known exactly. There the lasso again appeared to select too few predictors, while the elastic net with the mixing parameter near 0.1 performed better, though the comparison had to be interpreted cautiously because the correct answer was unknown. On real data, a panel of 5570 Fleckvieh bulls genotyped at 50,000 SNPs and measured for milk fat content, the lasso and elastic net together identified somewhere between 1291 and 1966 important SNPs, with major peaks on chromosomes 5, 14, 15 and 20. The highest signal on chromosome 14 pointed to DGAT1, a gene already known to have a large effect on fat content. A single-marker analysis of the same data, by contrast, selected 160 markers, a far shorter list.⁠[2]

Comparing the penalties head to head in breeding

Genomic selection poses the same arithmetic in a different guise. Rather than hunting for individual variants, the aim is to predict an animal's or plant's breeding value from markers spread across the whole genome, so that candidates can be ranked before they are ever measured. A comparison of six regularized linear methods on simulated data from the QTL-MAS 2011 workshop, comprising 3000 progeny of 20 sires and 200 dams with 9990 SNP markers on five chromosomes, trained each model on 2000 phenotyped individuals and predicted the remaining 1000.⁠[3] The six were ridge regression, ridge regression in its mixed-model form, the lasso, an adaptive lasso, the elastic net, and an adaptive elastic net.

All six predicted reasonably well, but they did not tie. The lasso, elastic net and their adaptive versions had similar accuracies and outperformed both forms of ridge regression, judged by the correlation between predicted and true genomic values and by the root mean squared error. The pattern held when accuracy was measured against true breeding values, though all models scored lower on that yardstick. Ridge regression did slightly better than its mixed-model variant, and the adaptive elastic net slipped below both ridge methods on one of the criteria. The overall reading was that the lasso-type methods, which select markers as they fit, predicted better than ridge regression, which keeps all of them.⁠[3]

That result sits alongside the earlier finding rather than contradicting it. In the association setting, where the question was which markers matter, the elastic net's compromise between selection and correlation-tolerance beat the lasso's sharper selectivity. In the prediction setting, where the question was how accurately a breeding value can be guessed, the selecting methods as a group beat the one that never selects. Both results point the same way: the penalty should be chosen to match the job, and the evidence from genetics is largely a record of what happens when it is not.

In genetic data the penalty is doing the variable selection, so the choice of penalty and tuning criterion decides which variants the model names, not merely how well it predicts.

In practice

Regularization in deep learning practice

A deep network has far more adjustable weights than a classical regression, and it is trained on data that is often scarce by the standards of the field. The regularization techniques described earlier therefore do not appear in isolation in real systems; they are stacked, tuned against one another, and their effects are read off the accuracy of the trained model. What follows is how that stacking looks in three working models, drawn from three different scientific settings.

A labeled diagram of a convolutional neural network in Hindi, with an input image of a page showing a rabbit, feature-learning layers of stacked feature maps, a flatten step, fully connected layers, and output class scores for rabbit-like categories.
A labeled diagram of a convolutional neural network in Hindi, with an input image of a page showing a rabbit, feature-learning layers of stacked feature maps, a flatten step, fully connected layers, and output class scores for rabbit-like categories. View full-size image.Convolutional-Neural-Network-Hindi by Irisbox. CC BY 4.0, via Wikimedia Commons. Scaled to 960 pixels wide; no crop or other changes by Atlas Nova.

A convolutional network for brain signals

Electroencephalography, or EEG, records the electrical activity of the brain from electrodes on the scalp. The signal is noisy in a specific way: sources that carry no information about the task often affect the recording more strongly than the sources that do, so the ratio of signal to noise is low. A group studying convolutional neural networks for decoding imagined or executed movements from raw EEG had to make such networks work in exactly this regime, and they evaluated a range of design choices drawn from recent machine learning research, among them dropout as a regularization strategy, batch normalization, and exponential linear units as the activation function.⁠[1]

The results separated the techniques by how much they mattered. Batch normalization and exponential linear units proved crucial for reaching high decoding accuracy, and the deep ConvNets reached mean accuracies of 84.0 percent against 82.1 percent for filter bank common spatial patterns, an established method for this kind of decoding. The improvement from these techniques was most pronounced for the deep network on a restricted frequency band, a setting in which the authors judged the networks could easily overfit because band power features were likely dominant. Combining batch normalization with dropout gave some further gains, though with variation across architectures and frequency bands, and the improvement was not obvious in advance because batch normalization can in some cases remove the need for dropout.⁠[1] That last point is worth pausing on: two regularizers aimed at different mechanisms can overlap, so adding both does not reliably add their separate benefits.

The study also attacked overfitting from the data side rather than the model side. Rather than training on whole trials, the networks were trained on multiple crops, windows shifted through each trial, which multiplies the number of training examples. Cropped training drastically increased accuracies on the restricted frequency band, consistent with the reading that overfitting was the obstacle there.⁠[1] The two remedies, a regularized architecture and an enlarged training set, were pulling in the same direction.

Multitask training as an implicit penalty

A second setting comes from molecular machine learning, where the task is to predict properties of chemical compounds from their structure. MoleculeNet, a benchmark collection assembled to compare such methods on a common footing, covers over 700,000 compounds across a wide range of property types, from quantum mechanical quantities to measured effects on the human body. Its benchmark results carry an observation about regularization that is easy to miss: most models scored higher on their training data than on validation or test data, indicating that overfitting was a general issue, and the gap was largest for single-task logistic regression.⁠[14]

Models that predicted many tasks at once showed less of that gap. Multitask training, in which one model is fitted to several related prediction tasks simultaneously, generally showed less overfitting, which the authors read as a regularizing effect. The mechanism is not mysterious once stated: each individual task in these datasets has only a small amount of data, and combining tasks gives the model a larger pool of examples to learn from, which can partly compensate for the scarcity of data on any one task.⁠[14] The model is constrained not by a penalty on its weights but by the requirement that its internal representations serve several jobs at once, and a representation that serves several jobs is less likely to be tuned to the accidents of one.

The same benchmark offers a caution about where regularization stops helping. For the smaller single-task datasets, under 3000 samples, differences between models were less clear, and kernel support vector machines and ensemble tree methods were more robust under that data scarcity than the more complex graph-based models, which generally need more training data.⁠[14] Regularization buys a model room to be complex without memorizing, but it does not manufacture information that is not in the data.

Reading the weights of a regularized model

The third setting is structure-based drug discovery, where a model predicts how tightly a small molecule binds to a protein. One such network, Pafnucy, represents the protein-ligand complex as a three-dimensional grid and processes it with three-dimensional convolutions, treating the atoms of the protein and of the ligand in the same way; that shared treatment was itself intended as a regularization technique, forcing the network to discover general properties of protein-ligand interactions rather than learning separate rules for each side. The network was trained with an L2 penalty.⁠[15]

The L2 penalty left a visible trace in the trained model, and that trace is what makes the example instructive. The weights of the first layer's convolutional filters started close to zero and spread out during training, since weights with larger absolute values pass more information to deeper layers; because the network was trained with L2 regularization, only the weights that mattered were likely to reach large absolute values.⁠[15] Inspecting those weights therefore gives a rough picture of what the network found useful. The weights for selenium and boron barely moved from zero, which could mean either that other features were more important or that those atom types were too rare in the training data for the network to find any general pattern.⁠[15]

A separate probe confirmed that the network was relying on the right parts of its input. Deleting small cubic regions from the complex and recording how far the predicted affinity fell identified the ligand and its immediate neighbourhood as the most important region, containing the amino acids that form hydrogen bonds and π-π interactions with the ligand.⁠[15] This is the practical value of a penalty in a scientific model: it does not merely improve prediction, it leaves the fitted weights sparse enough and structured enough that a researcher can ask what the model learned and get an answer.

Across the three settings the pattern repeats. Regularization in deep learning is rarely a single technique applied once; it is a set of choices about architecture, training data, task structure and penalty, each of which constrains the fit in a different way, and the evidence for any one of them comes from comparing trained models rather than from theory alone. Where those choices interact badly, or where a technique that helps in one setting fails in another, is taken up later.

In deep models the regularizers are stacked and judged by the accuracy they produce, and a penalty can double as a window into what the network has learned.

Criticism

Costs, pitfalls and open questions

The price of shrinkage

Two parallel diagrams connect four input nodes to a prediction, showing one retained coefficient for lasso and three for elastic net alongside their penalty formulas.
Lasso may retain one of several correlated predictors, while elastic net can retain the group. The illustrated selection is a possible outcome and does not establish causation. View full-size image.Lasso and Elastic Net Selection by Atlas Nova. Illustration generated with AI for this article and checked against its text.

Every regularized fit is, by construction, a compromise, and the compromise has a measurable cost. The compensation is smaller variance, meaning the estimates move less from one training sample to the next, and because total error combines both, a biased estimator can still predict better than an unbiased one.⁠[2] This is not a defect to be engineered away but the mechanism by which regularization works. It does mean, though, that a penalized model's coefficients should not be read as honest estimates of effect size. A geneticist who reports the weight the lasso assigned to a marker is reporting a number that was deliberately pulled toward zero, and the amount of pull depends on the tuning parameter.⁠[2]

The bias has a second consequence that is easy to overlook. Because the penalty is tuned by cross-validation on a finite sample, the chosen strength carries its own uncertainty, and the fitted coefficients inherit it. The stability of a penalized model is thus partly a property of the tuning procedure, not only of the data.

Where the lasso fails

The lasso's weaknesses have been documented in the literature. When predictor variables are highly correlated, the lasso tends to select one member of a correlated group and set the others to zero, and in the extreme case of several identical predictors it breaks down altogether. It also cannot select more predictors than there are samples, a real constraint in genomic studies where markers vastly outnumber individuals.⁠[2] These are not edge cases in the fields where penalized regression is most used. Genetic markers are correlated by construction, through linkage disequilibrium, and the number of markers routinely exceeds the number of people or animals measured.

The elastic net was designed to soften both failures, and the evidence from genetic data shows it doing so: at the minMSE + 1SE stopping criterion, with its mixing parameter near 0.1, it recovered the true predictors without false positives in the high and low correlation simulated settings, with only a few missing correct predictors in the mixed correlation setting.⁠[2] But the elastic net does not abolish the underlying tension, it redistributes it. The mixing parameter is a second dial, and the same study found that the setting which selected best was not the setting that minimized prediction error, so tuning both dials by a single criterion still walks past the model a selector would want.⁠[2]

A sharper result concerns the lasso path itself, the sequence of models produced as the penalty is relaxed from strong to weak. In a regime of linear sparsity, where the fraction of variables with a real effect stays fixed however small, true features and null features are always interspersed along the path, no matter how strong the effect sizes are. The analysis derives a trade-off between false and true positive rates: to push the false negative rate below a critical value, the false positive rate must exceed a threshold somewhere on the path, so the two error rates cannot both be held low at once.⁠[16] The practical reading is that there is no point on the lasso path at which the selected set is clean and complete. Choosing a point on the path is choosing which kind of error to tolerate, and the choice cannot be avoided by tuning harder.

What the model kept, and why it is hard to say

A regularized model returns a shorter list of variables than an unpenalized one, which looks like interpretability. It is a weaker kind of interpretability than it appears. When predictors are correlated, the lasso usually selects only one predictor from a group while ignoring the others. The elastic net makes use of both penalty terms to select also correlated features.⁠[2] A selected set is a set of variables that jointly predict well, not a set of causes.

The difficulty deepens in models where the penalty acts on internal weights rather than on named inputs. In a network trained with an L2 penalty, the weights of the first layer spread out during training, and because only the weights that matter are likely to reach large absolute values, inspecting them gives a rough picture of what the network found useful.⁠[15] That picture is genuinely informative, but it is a picture of the model, not of the world. The same caution applies to the variables a penalized regression keeps: selection is a statement about predictive usefulness within the training distribution, and a variable can be useful there for reasons that will not hold elsewhere.

Why the same technique helps in one place and not another

An open question is why regularizers that help in one setting fail to help, or help less, in another. The EEG study found that batch normalization and exponential linear units were crucial for reaching high decoding accuracy, and that combining batch normalization with dropout gave some further gains, though with variation across architectures and frequency bands. The gain from combining batch normalization with dropout was not clear from the start, because batch normalization can in some cases remove the need for dropout.⁠[1] Two techniques aimed at different mechanisms can overlap, so their benefits do not simply add.

Weight decay presents the same puzzle in a different form. An empirical investigation across three optimization algorithms and a range of architectures identified three distinct mechanisms by which weight decay exerts its regularizing effect, depending on the algorithm and architecture: increasing the effective learning rate, approximately regularizing the norm of the network's input-output Jacobian, and reducing the effective damping coefficient in second-order optimization. The traditional reading of weight decay as nothing more than an L2 penalty is therefore incomplete, and literal weight decay outperformed L2 regularization for optimizers in which the two differ.⁠[8] A technique whose name suggests one mechanism may be working through another, and which one depends on what it is paired with.

This is where the field currently stands. The open questions are not whether regularization works but how to predict, for a given model, dataset and optimizer, which regularizer will help and how much of it to apply.

Shrinkage buys lower variance at the cost of biased coefficients, and no tuning criterion removes the trade-off; it only decides which error to accept.

Key studies

YearStudySampleDesignFinding
2012Ogutu et al.⁠[3]3000 progenies of 20 sires and 200 dams, with 9990 biallelic SNP-marker loci simulatedSimulation comparing six regularized regression methodsThe elastic net reached a Pearson correlation of 0.5071 with the true genomic value, and the lasso type methods outperformed ridge regression and ridge regression BLUP.
2013Waldmann et al.⁠[2]5570 Fleckvieh bulls genotyped on a 50 K SNP panel, plus two simulated data setsComparison of the lasso and the elastic net with 10-fold cross-validationAt one standard error above the minimum mean squared error, the lasso selected a median of only 3 correct predictor variables out of 25 and no false positives, while the elastic net with a penalty weight around 0.1 gave the best compromise.
2017Su et al.⁠[16]100 independent simulated experiments under a Gaussian random designAsymptotic analysis and simulation of the lasso pathThe first noise variable entered the lasso model before 44% of the true signals were detected, and the average false discovery proportion was 15% when all signals were detected.
2017Schirrmeister et al.⁠[1]EEG recordings from subjects performing imagined or executed tasksDeep convolutional neural network decoding studyDeep ConvNets reached mean decoding accuracies of 84.0%, compared with 82.1% for filter bank common spatial patterns.
2018Zhang et al.⁠[8]Multiple network architectures trained with SGD, Adam and K-FACEmpirical study of weight decay mechanismsWeight decay acts through three distinct mechanisms depending on the optimizer and architecture, including increasing the effective learning rate.
2018Wu et al.⁠[14]Multiple public molecular datasets in the MoleculeNet benchmarkBenchmark of molecular machine learning modelsMultitask training showed less overfitting than singletask logistic regression, suggesting a regularizing effect.
2018Stepniewska-Dziubinska et al.⁠[15]Protein-ligand complexes from the CASF-2013 benchmark and Astex Diverse SetDeep learning model for binding affinity predictionThe model started to overfit after 14 epochs of training, and the best weights were saved from that point.
2019Vabalas et al.⁠[13]55 studies applying machine learning to autism classification, plus simulationsLiterature review and simulation study of validation methodsSmall sample size was associated with higher reported classification accuracy, and K-fold cross-validation produced strongly biased estimates even at a sample size of 1000.
2019Miyato et al.⁠[10]Benchmark datasets SVHN and CIFAR-10Supervised and semi-supervised learning experiments with virtual adversarial trainingVirtual adversarial training with entropy minimization achieved state-of-the-art performance for semi-supervised learning on SVHN and CIFAR-10.
2019Emmert-Streib & Dehmer⁠[7]Review of regression models including the lasso, adaptive lasso, elastic net and group lassoMethodological reviewRegularization terms induce coefficient shrinkage and variable selection, making these models valuable tools for high-dimensional problems.

See also

References

  1. Schirrmeister, R. T., Springenberg, J. T., Fiederer, L. D. J., Glasstetter, M., Eggensperger, K., Tangermann, M., Hutter, F., Burgard, W., & Ball, T. (2017). Deep learning with convolutional neural networks for EEG decoding and visualization. Human Brain Mapping, 38(11), 5391-5420. doi:10.1002/hbm.23730
  2. Waldmann, P., Mészáros, G., Gredler, B., Fuerst, C., & Sölkner, J. (2013). Evaluation of the lasso and the elastic net in genome-wide association studies. Frontiers in Genetics, 4. doi:10.3389/fgene.2013.00270
  3. Ogutu, J. O., Schulz-Streeck, T., & Piepho, H. P. (2012). Genomic selection using regularized linear regression models: ridge regression, lasso, elastic net and their extensions. BMC Proceedings, 6(S2). doi:10.1186/1753-6561-6-s2-s10
  4. Kukačka, J., Golkov, V., & Cremers, D. (2017). Regularization for Deep Learning: A Taxonomy. arXiv. doi:10.48550/arxiv.1710.10686 Free full text
  5. Okser, S., Pahikkala, T., Airola, A., Salakoski, T., Ripatti, S., & Aittokallio, T. (2014). Regularized Machine Learning in the Genetic Prediction of Complex Traits. PLoS Genetics, 10(11), e1004754. doi:10.1371/journal.pgen.1004754
  6. Ghojogh, B., & Crowley, M. (2019). The Theory Behind Overfitting, Cross Validation, Regularization, Bagging, and Boosting: Tutorial. arXiv. doi:10.48550/arxiv.1905.12787 Free full text
  7. Emmert-Streib, F., & Dehmer, M. (2019). High-Dimensional LASSO-Based Computational Regression Models: Regularization, Shrinkage, and Selection. Machine Learning and Knowledge Extraction, 1(1), 359-383. doi:10.3390/make1010021
  8. Zhang, G., Chaoqi, W., Xu, B., & Grosse, R. (2018). Three Mechanisms of Weight Decay Regularization. arXiv. doi:10.48550/arxiv.1810.12281 Free full text
  9. Shorten, C., Khoshgoftaar, T. M., & Furht, B. (2021). Text Data Augmentation for Deep Learning. Journal of Big Data, 8(1). doi:10.1186/s40537-021-00492-0
  10. Miyato, T., Maeda, S. I., Koyama, M., & Ishii, S. (2019). Virtual Adversarial Training: A Regularization Method for Supervised and Semi-Supervised Learning. IEEE Transactions on Pattern Analysis and Machine Intelligence, 41(8), 1979-1993. doi:10.1109/tpami.2018.2858821
  11. Abraham, A., Pedregosa, F., Eickenberg, M., Gervais, P., Mueller, A., Kossaifi, J., Gramfort, A., Thirion, B., & Varoquaux, G. (2014). Machine learning for neuroimaging with scikit-learn. Frontiers in Neuroinformatics, 8. doi:10.3389/fninf.2014.00014
  12. Kourou, K., Exarchos, T. P., Exarchos, K. P., Karamouzis, M. V., & Fotiadis, D. I. (2015). Machine learning applications in cancer prognosis and prediction. Computational and Structural Biotechnology Journal, 13, 8-17. doi:10.1016/j.csbj.2014.11.005
  13. Vabalas, A., Gowen, E., Poliakoff, E., & Casson, A. J. (2019). Machine learning algorithm validation with a limited sample size. PLOS ONE, 14(11), e0224365. doi:10.1371/journal.pone.0224365
  14. Wu, Z., Ramsundar, B., Feinberg, E. N., Gomes, J., Geniesse, C., Pappu, A. S., Leswing, K., & Pande, V. (2018). MoleculeNet: a benchmark for molecular machine learning. Chemical Science, 9(2), 513-530. doi:10.1039/c7sc02664a
  15. Stepniewska-Dziubinska, M. M., Zielenkiewicz, P., & Siedlecki, P. (2018). Development and evaluation of a deep learning model for protein–ligand binding affinity prediction. Bioinformatics, 34(21), 3666-3674. doi:10.1093/bioinformatics/bty374
  16. Su, W., Bogdan, M., & Candès, E. (2017). False discoveries occur early on the Lasso path. The Annals of Statistics, 45(5), 2133-2150. doi:10.1214/16-aos1521

Cite this page: Atlas Nova editors. (2026). Regularization (machine learning). Atlas Nova. https://velocer.io/atlas/regularization-machine-learning/