Feature selection, L1 vs. L2 regularization, and rotational invariance

A. Ng

article2004ICML2,111 citations
Listen

Modern predictive modeling frequently encounters high-dimensional data containing numerous irrelevant variables alongside a small set of truly informative features. In these settings, learning algorithms are prone to overfitting, where models memorize noise rather than true patterns and subsequently perform poorly on new data. The primary operational bottleneck is sample complexity, which is the volume of training data required to achieve dependable classification. When the number of features vastly exceeds available samples, organizations face severe performance degradation and escalating data collection costs.

This article evaluates how different penalty methodsspecifically first-power magnitude penalties (L1 regularization) versus squared magnitude penalties (L2 regularization)—impact the sample requirements of logistic regression in high-dimensional environments. It aims to theoretically establish and experimentally demonstrate why certain algorithms successfully identify relevant features while others fail when irrelevant dimensions are introduced.

To establish these properties, the article combines statistical learning theory with controlled numerical simulations. The mathematical analysis derives lower bounds on sample complexity using covering number bounds and the geometric concept of rotational invariance, which describes algorithms whose predictions remain identical regardless of coordinate system rotations. The theoretical findings were validated across three synthetic experimental scenarios using data drawn from normal distributions: a single relevant feature, three relevant features, and exponentially decaying feature relevance across multiple dimensions, with all results averaged over 100 trials using a 30 percent hold-out validation split.

The article establishes three key findings. First, logistic regression with L1 regularization achieves a sample complexity that grows only logarithmically with the total number of features. This ensures effective model training even when irrelevant features exponentially outnumber training examples. Second, L2-regularized logistic regression is mathematically proven to be rotationally invariant, causing its sample complexity to scale linearly with the number of input features. Third, this linear sample requirement applies broadly to all rotationally invariant methods, including standard support vector machines and spherically initialized neural networks, leading to rapid performance degradation when irrelevant features are present.

These findings have direct implications for project risk, timelines, and analytical costs. Deploying rotationally invariant models or L2 regularization on uncurated, high-dimensional data demands an impractically large volume of training data to prevent severe error rates. In contrast, utilizing L1 regularization automatically suppresses irrelevant variables, allowing organizations to achieve high predictive accuracy with significantly smaller datasets and lower data acquisition expenses.

Organizations handling high-dimensional data with sparse informative signals should prioritize L1-regularized models or incorporate explicit, non-rotationally invariant feature selection prior to training. Teams should avoid standard L2 regularization and kernel methods when the feature-to-sample ratio is high unless substantial feature pruning is performed beforehand. Future implementation initiatives should test these approaches on domain-specific empirical datasets to evaluate whether these theoretical sample efficiencies persist under non-normal data distributions and complex noise patterns.

The conclusions carry high theoretical confidence based on rigorous mathematical bounds, though practical caution is advised regarding specific boundary conditions. The theoretical guarantees rely strictly on log-loss error metrics within generalized linear frameworks, and the experimental validations utilized synthetic, normally distributed data. Practitioners should anticipate potential performance variations when applying these methods to real-world datasets with complex, non-linear dependencies or severe class imbalances.

Abstract

This document is a presentation slide deck and does not contain an abstract.

Knowls

  1. Knowl 1 — Sample Complexity Bound for L1-Regularized Logistic Regression

    theoretical result

    For a binary classification problem over Rn\mathbb{R}^n, let mm be the number of training examples and nn the total number of features. Suppose there exists a true underlying parameter vector θRn\theta^* \in \mathbb{R}^n that is rr-sparse (having at most rr non-zero components with rnr \ll n), where every component satisfies θiK|\theta_i^*| \le K (for K1K \ge 1).

    Let θ^\hat{\theta} be the parameter vector obtained by training L1L_1-regularized logistic regression over the constraint set ΘB={θRn:θ1B}\Theta_B = \{\theta \in \mathbb{R}^n : \|\theta\|_1 \le B\} for B{0,1,,C}B \in \{0, 1, \dots, C\} with C=rKC = rK, using a hold-out validation set to select BB. For any error parameter ϵ>0\epsilon > 0 and confidence parameter δ(0,1)\delta \in (0, 1), to guarantee that the expected negative log-likelihood (log-loss) satisfies el(θ^)el(θ)+ϵe_l(\hat{\theta}) \le e_l(\theta^*) + \epsilon with probability at least 1δ1 - \delta, it suffices that the number of training examples satisfies: m=Ω((logn)poly(r,K,log(1/δ),1/ϵ,C))m = \Omega\left((\log n) \cdot \text{poly}(r, K, \log(1/\delta), 1/\epsilon, C)\right) where el(θ)=E(x,y)D[logp(yx;θ)]e_l(\theta) = \mathbb{E}_{(x, y) \sim \mathcal{D}}[-\log p(y \mid x; \theta)].

    This establishes that the sample complexity of L1L_1-regularized logistic regression grows only logarithmically with the total number of features nn, demonstrating that L1L_1 regularization can successfully learn when the number of irrelevant features is exponentially larger than the training set size.

  2. Knowl 2 — Sample Complexity Lower Bound for Rotationally Invariant Learning Algorithms

    theoretical result

    Let L\mathcal{L} be any learning algorithm that is rotationally invariant. For any error target ϵ(0,1/8)\epsilon \in (0, 1/8) and confidence parameter δ(0,1/100)\delta \in (0, 1/100), there exists a distribution D\mathcal{D} over (x,y)Rn×{0,1}(x, y) \in \mathbb{R}^n \times \{0, 1\} in which the class label depends on only a single feature (specifically, y=1    x1ty = 1 \iff x_1 \ge t for some threshold tt), such that for L\mathcal{L} to achieve a 0/10/1 misclassification test error of at most ϵ\epsilon with probability at least 1δ1 - \delta, the required number of training examples must satisfy: m=Ω(nϵ)m = \Omega\left(\frac{n}{\epsilon}\right) where nn is the total number of input features.

    Consequently, any rotationally invariant learning algorithm has a sample complexity that scales at least linearly with the total dimension nn, making rotationally invariant algorithms ineffective for feature selection in high-dimensional spaces containing many irrelevant features.

  3. Knowl 3 — Rotational Invariance of Learning Algorithms

    definition

    Let MR={MRn×nMMT=MTM=I,det(M)=+1}\mathcal{M}_R = \{M \in \mathbb{R}^{n \times n} \mid M M^T = M^T M = I, \det(M) = +1\} denote the group of n×nn \times n orthogonal rotation matrices.

    Given a training dataset S={(x(i),y(i))}i=1mRn×YS = \{(x^{(i)}, y^{(i)})\}_{i=1}^m \subset \mathbb{R}^n \times \mathcal{Y}, let MS={(Mx(i),y(i))}i=1mMS = \{(M x^{(i)}, y^{(i)})\}_{i=1}^m denote the dataset obtained by rotating every input vector x(i)x^{(i)} by MM.

    Let L[S]:RnY\mathcal{L}[S]: \mathbb{R}^n \to \mathcal{Y} denote the hypothesis (classifier) produced by training a learning algorithm L\mathcal{L} on dataset SS. The algorithm L\mathcal{L} is defined to be rotationally invariant if, for every rotation matrix MMRM \in \mathcal{M}_R, any training set SS, and any evaluation point xRnx \in \mathbb{R}^n, the output hypothesis satisfies: L[S](x)=L[MS](Mx)\mathcal{L}[S](x) = \mathcal{L}[MS](Mx)

  4. Knowl 4 — Rotational Invariance of L2 Regularization and Non-Invariance of L1 Regularization

    theoretical result

    Logistic regression regularized by the L2L_2 norm is rotationally invariant, whereas logistic regression regularized by the L1L_1 norm is not rotationally invariant.

    For L2L_2-regularized logistic regression with regularizer R(θ)=θ22=θTθR(\theta) = \|\theta\|_2^2 = \theta^T \theta, rotating the training data S=MSS' = MS (where MTM=IM^T M = I) and transforming the parameters as θ=Mθ\theta' = M\theta preserves both the conditional likelihood and the regularization penalty: p(yMx;Mθ)=11+exp((Mθ)T(Mx))=11+exp(θTMTMx)=p(yx;θ)p(y \mid Mx; M\theta) = \frac{1}{1 + \exp(-(M\theta)^T (Mx))} = \frac{1}{1 + \exp(-\theta^T M^T M x)} = p(y \mid x; \theta) R(Mθ)=(Mθ)T(Mθ)=θTMTMθ=R(θ)R(M\theta) = (M\theta)^T (M\theta) = \theta^T M^T M \theta = R(\theta) As a result, the regularized log-likelihood objective on rotated data satisfies J(Mθ)=J(θ)J'(M\theta) = J(\theta), yielding optimal parameter estimate θ^=Mθ^\hat{\theta}' = M\hat{\theta} and ensuring L[MS](Mx)=L[S](x)\mathcal{L}[MS](Mx) = \mathcal{L}[S](x).

    For L1L_1 regularization, the penalty R(θ)=θ1=i=1nθiR(\theta) = \|\theta\|_1 = \sum_{i=1}^n |\theta_i| is not invariant under orthogonal transformations (i.e., Mθ1θ1\|M\theta\|_1 \ne \|\theta\|_1 in general). The coordinate-axis alignment of the L1L_1 norm breaks rotational symmetry, enabling L1L_1-regularized models to perform sparse feature selection along canonical coordinate axes.

  5. Knowl 5 — Regularized Logistic Regression Model Formulations

    model/method

    Binary logistic regression models the conditional probability of label y{0,1}y \in \{0, 1\} given an input vector xRnx \in \mathbb{R}^n (including a constant feature x0=1x_0 = 1 to incorporate the intercept term) parameterized by θRn\theta \in \mathbb{R}^n as: p(y=1x;θ)=11+exp(θTx)p(y = 1 \mid x; \theta) = \frac{1}{1 + \exp(-\theta^T x)}

    Given mm i.i.d. training points {(x(i),y(i))}i=1m\{(x^{(i)}, y^{(i)})\}_{i=1}^m, regularized logistic regression can be trained via two equivalent formulations connected by Lagrangian duality:

    1. Unconstrained penalty formulation: θ^=argmaxθi=1mlogp(y(i)x(i);θ)αR(θ)\hat{\theta} = \arg\max_\theta \sum_{i=1}^m \log p(y^{(i)} \mid x^{(i)}; \theta) - \alpha R(\theta) where α>0\alpha > 0 dictates the regularization penalty.

    2. Constrained formulation: maxθi=1mlogp(y(i)x(i);θ)subject toR(θ)B\max_\theta \sum_{i=1}^m \log p(y^{(i)} \mid x^{(i)}; \theta) \quad \text{subject to} \quad R(\theta) \le B where B>0B > 0 bounds the parameter norm.

    For L1L_1 regularization, R(θ)=θ1=j=1nθjR(\theta) = \|\theta\|_1 = \sum_{j=1}^n |\theta_j|; for L2L_2 regularization, R(θ)=θ22=j=1nθj2R(\theta) = \|\theta\|_2^2 = \sum_{j=1}^n \theta_j^2.

  6. Knowl 6 — L1-Regularized Logistic Regression Training Algorithm with Hold-Out Validation

    algorithm
    Input: Training dataset S={(x(i),y(i))}i=1mS = \{(x^{(i)}, y^{(i)})\}_{i=1}^m, hold-out fraction γ(0,1)\gamma \in (0, 1), maximum constraint bound CNC \in \mathbb{N}
    Output: Final parameter vector θ^\hat{\theta}
    Split SS into training subset S1S_1 of size (1γ)m(1-\gamma)m and validation subset S2S_2 of size γm\gamma m
    for B=0,1,2,,CB = 0, 1, 2, \dots, C do
        Fit logistic regression on S1S_1 subject to the L1L_1 norm constraint:
            θB=argmaxθ(x(i),y(i))S1logp(y(i)x(i);θ)s.t.θ1B\theta_B = \arg\max_\theta \sum_{(x^{(i)}, y^{(i)}) \in S_1} \log p(y^{(i)} \mid x^{(i)}; \theta) \quad \text{s.t.} \quad \|\theta\|_1 \le B
        Evaluate empirical log-loss on the validation set S2S_2:
            e^l(θB)=1S2(x(i),y(i))S2logp(y(i)x(i);θB)\hat{e}_l(\theta_B) = -\frac{1}{|S_2|} \sum_{(x^{(i)}, y^{(i)}) \in S_2} \log p(y^{(i)} \mid x^{(i)}; \theta_B)
    end for
    Select B=argminB{0,1,,C}e^l(θB)B^* = \arg\min_{B \in \{0, 1, \dots, C\}} \hat{e}_l(\theta_B)
    return θ^=θB\hat{\theta} = \theta_{B^*}

    The algorithm fits an L1L_1-constrained logistic regression model across discrete constraint values B{0,1,,C}B \in \{0, 1, \dots, C\} on training split S1S_1 and chooses the bound BB^* that achieves minimal negative log-likelihood on the hold-out split S2S_2.

  7. Knowl 7 — Rotational Invariance in Standard Machine Learning Algorithms

    theoretical result

    Several prominent supervised and unsupervised learning algorithms belong to the class of rotationally invariant algorithms:

    • Support Vector Machines (SVMs) using linear kernels, polynomial kernels, radial basis function (RBF) kernels, or any kernel K(x,z)K(x, z) that is a function solely of inner products xTxx^T x, xTzx^T z, and zTzz^T z.
    • Multilayer Feedforward Neural Networks trained via backpropagation, provided initial weights are sampled independently from a spherically symmetric distribution.
    • Unregularized Logistic Regression fit via standard maximum likelihood.
    • The Perceptron Algorithm.
    • Principal Component Analysis (PCA) and Independent Component Analysis (ICA) for dimensionality reduction, assuming input features are not individually pre-standardized to unit variance.

    Because of their rotational invariance, all such algorithms are constrained by the linear sample complexity lower bound Ω(n/ϵ)\Omega(n/\epsilon) in high-dimensional feature selection settings.

  8. Knowl 8 — Degradation of Support Vector Machines with Irrelevant Features

    theoretical result

    While Support Vector Machines (SVMs) can learn effectively in high dimensions when a large margin exists, their generalization error degrades linearly with the addition of irrelevant features due to data sphere expansion.

    The expected error bound of an SVM classifier depends directly on the ratio: r2γ2\frac{r^2}{\gamma^2} where γ\gamma is the geometric margin and r=maxix(i)2r = \max_i \|x^{(i)}\|_2 is the radius of the smallest ball enclosing the data.

    Introducing nn zero-mean, independent irrelevant features does not alter the margin γ\gamma along the relevant separating dimensions, but it increases the squared radius r2r^2 linearly in nn (r2=O(n)r^2 = O(n)). As a consequence, SVM generalization performance degrades when numerous irrelevant features are present.

  9. Knowl 9 — Experimental Setup for L1 vs. L2 Regularized Logistic Regression

    experimental setup

    To evaluate the feature selection efficiency of L1L_1 versus L2L_2 regularization, binary classification datasets are generated from a logistic generative model: p(y=1x;θ)=11+exp(θTx)p(y = 1 \mid x; \theta) = \frac{1}{1 + \exp(-\theta^T x)} where input vectors xRnx \in \mathbb{R}^n are drawn i.i.d. from a standard multivariate Gaussian distribution N(0,I)\mathcal{N}(0, I).

    For each trial, 30%30\% of the generated training data is held out to select the regularization parameter BB, and models are evaluated on test data using negative log-likelihood (log-loss) and 0/10/1 misclassification error averaged over 100 independent trials. The number of total features nn ranges from 1 to 1000 with fixed training sample sizes m{100,200}m \in \{100, 200\}.

    Three parameter configurations are evaluated:

    1. Single relevant feature: θ1=10\theta_1 = 10, and θi=0\theta_i = 0 for all i>1i > 1.
    2. Three relevant features: θ1=θ2=θ3=10/3\theta_1 = \theta_2 = \theta_3 = 10/\sqrt{3}, and θi=0\theta_i = 0 for all i>3i > 3.
    3. Exponentially decaying relevance: θi=75(1/2)i1\theta_i = \sqrt{75} \cdot (1/2)^{i-1} for i1i \ge 1.
  10. Knowl 10 — Empirical Performance Comparison of L1 and L2 Regularization with Irrelevant Features

    empirical result

    In synthetic experiments comparing L1L_1-regularized and L2L_2-regularized logistic regression across n=1n = 1 to 10001000 features with fixed training sample sizes m=100m = 100 and m=200m = 200:

    • L1L_1 Regularization: Test log-loss and misclassification error remain stable and grow very slowly with the number of irrelevant features. For 1 relevant feature with m=100m = 100, log-loss increases slightly from 0.22\approx 0.22 at n=1n=1 to plateau below 0.300.30 at n=1000n=1000, and misclassification error remains around 0.100.150.10\text{--}0.15.
    • L2L_2 Regularization: Test error and log-loss degrade rapidly as irrelevant features increase. For 1 relevant feature with m=100m = 100, log-loss rises steeply from 0.22\approx 0.22 towards 0.70\approx 0.70 (approaching the random guessing baseline of ln20.693\ln 2 \approx 0.693), while misclassification error rises from <0.10< 0.10 to over 0.400.450.40\text{--}0.45 by n=1000n = 1000.

    Identical patterns of rapid failure for L2L_2 regularization and robust performance for L1L_1 regularization occur in both the 3-relevant-features and exponentially decaying relevance experiments.

Coverage note — Standard textbook background material covered in the slides (general definitions of overfitting, polynomial cross-validation, standard VC-dimension, and general exponential families/GLM definitions) was omitted as it does not constitute the paper's original contributions.

References

  1. 1.Anthony, M., & Bartlett, P. (1999). Neural network learning: Theoretical foundations. Cambridge University Press.
  2. 2.Duda, R., Hart, P., Stork, P. (2000). Pattern Classification, 2nd Ed. John Wiley & Sons.
  3. 3.Hastie, T., Tibshirani, R., Friedman J. (2001). The Elements of Statistical Learning. Springer-Verlag.
  4. 4.Jaakkola, T. (2004). Machine Learning lecture notes. Available online at http://people.csail.mit.edu/people/tommi/courses.html
  5. 5.McCullagh, P., & Nelder, J. A. (1989). Generalized linear models (second edition). Chapman and Hall.
  6. 6.Ng, A. Y. (1998). On feature selection: Learning with exponentially many irrelevant features as training examples. Proceedings of the Fifteenth International Conference on Machine Learning (pp. 404-412). Morgan Kaufmann.
  7. 7.Ng, A. Y. (1998). Machine Learning lecture notes. Available online at http://www.stanford.edu/class/cs229/.
  8. 8.Vapnik, V. (1982). Estimation of dependences based on empirical data. Springer-Verlag.
  9. 9.Weston, J., Elisseeff, A., Schölkopf, B., Tipping, M. (2003). Use of the Zero-Norm with Linear Models and Kernel Methods. Journal of Machine Learning Research, 1439-1461.
  10. 10.Zhang, T. (2002). Covering number bounds of certain regularized linear function classes. Journal of Machine Learning Research, 527-550.

Citation

MLA
Ng, A. Y. “Feature Selection, L 1 Vs. L 2 Regularization, and Rotational Invariance”. Twenty-first International Conference on Machine Learning - ICML '04, 2004, p. 78, https://doi.org/10.1145/1015330.1015435.
APA
Ng, A. Y. (2004). Feature selection, L 1 vs. L 2 regularization, and rotational invariance. Twenty-first International Conference on Machine Learning - ICML '04, 78. https://doi.org/10.1145/1015330.1015435
Chicago
Ng, A. Y. 2004. “Feature Selection, L 1 Vs. L 2 Regularization, and Rotational Invariance”. Twenty-first International Conference on Machine Learning - ICML '04, 78. https://doi.org/10.1145/1015330.1015435.
Harvard
Ng, A.Y. (2004) “Feature selection, L 1 vs. L 2 regularization, and rotational invariance”, Twenty-first international conference on Machine learning - ICML '04. ACM Press, p. 78. Available at: https://doi.org/10.1145/1015330.1015435.
Vancouver
1. Ng AY (2004) Feature selection, L 1 vs. L 2 regularization, and rotational invariance. In: Twenty-first international conference on Machine learning - ICML '04. ACM Press, p 78

BibTeX

@inproceedings{Ng_2004, series={ICML ’04}, title={Feature selection,
                    <i>L</i>
                    <sub>1</sub>
                    vs.
                    <i>L</i>
                    <sub>2</sub>
                    regularization, and rotational invariance}, url={http://dx.doi.org/10.1145/1015330.1015435}, DOI={10.1145/1015330.1015435}, booktitle={Twenty-first international conference on Machine learning  - ICML ’04}, publisher={ACM Press}, author={Ng, Andrew Y.}, year={2004}, pages={78}, collection={ICML ’04} }
Metadata:Crossref

Access the Paper

This paper is available from its original source. Click below to access the PDF.

Open PDF

License: Authors