Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Taking turns fairly
Imagine several helpers explaining a mystery number. First you listen to the helper who agrees most with what’s still unexplained, but only until another helper becomes just as useful. Then you listen to both equally, until a third catches up, and so on. That is least angle regression: it never lets one helper hog the credit, it adds helpers one by one, and it records the whole story from “no helpers” to “everyone”.
LARS gives the full sequence of models, from one feature to all of them, for roughly the cost of a single regression. That lets you see which sensors enter first and at what point extra ones stop helping, before choosing a model size.
- 1. LARS adds features…
- 2. In the demo, the active features' correlations…
- 3. After all steps, LARS ends at…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Two features by hand
Take two standardised features, with correlations with y of x₁ᵀy = 5 and x₂ᵀy = 3, and correlation between features x₁ᵀx₂ = 0.
- Start at β = 0. x₁ is more correlated, so x₁ is active.
- Move β₁ up. The residual’s correlation with x₁ falls as 5 − γ, while with x₂ it stays at 3 (orthogonal features).
- At γ = 2 both correlations equal 3, so x₂ joins.
- Move along the bisector: both coefficients rise at the same rate, keeping the correlations tied, until both reach 0. That happens after another 3 units each, giving β = (5, 3), the least-squares answer.
Forward stepwise would have jumped straight to β₁ = 5 (the full least-squares fit on x₁) before adding x₂. Forward stagewise would creep by tiny ε steps, tracing almost the same path as LARS.
The steps in plain English:
- Find the feature most correlated with the residual.
- Move its coefficient toward the least-squares value until another feature is equally correlated with the residual.
- Move all active coefficients together, keeping their correlations equal.
- Repeat until all features are in.
- 1. In the hand example, x₂ joins when γ equals…
- 2. Forward stepwise differs from LARS by…
- 3. Forward stagewise uses…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.The algorithm
Notation: standardised features with unit norm, centred y, residual r = y − Xβ, correlations c = Xᵀr, active set A with signs s = sign(c_A), and C = max|c|.
- Equiangular direction. With X_A the sign-adjusted active columns and G = X_AᵀX_A:
- A_A = (1ᵀG⁻¹1)^(−1/2);
- w = A_A·G⁻¹1;
- u = X_A·w, a unit vector making equal angles with every active column.
- Step size. With a = Xᵀu:
- γ = the smallest positive value of (C − cⱼ)/(A_A − aⱼ) and (C + cⱼ)/(A_A + aⱼ) over inactive j;
- the next feature joins at that γ.
- Update: β_A += γ·s·w, then add the new feature.
Lasso modification. If an active coefficient would cross zero before γ, stop there and drop it. With this rule the path is exactly the lasso path. The breakpoints are the λ values where the active set changes, and λ = C/n at each one.
Cost. For n > p, the whole path takes O(np² + p³), about one least-squares fit.
from sklearn.linear_model import Lars, LassoLars, LassoLarsCV, lars_path
alphas, active, coefs = lars_path(X, y, method="lasso") # every breakpoint of the lasso path
model = LassoLarsCV(cv=5).fit(X, y)Use it when p is moderate, n is larger, and you want the exact path or a stepwise view. Prefer coordinate descent (glmnet) for very large p, sparse data, or elastic-net penalties.
- 1. The equiangular vector u has…
- 2. The lasso modification drops a feature when…
- 3. At a LARS-lasso breakpoint, λ equals…
Level 3: Advanced
★★★★☆ Advanced⏱ 35 minGraduate level, with full derivations and proofs.Why it works, and relatives
Equal correlations. Moving along u changes every active correlation at the same rate, A_A per unit γ, since X_Aᵀu = A_A·1. They therefore stay tied while inactive correlations change at rates aⱼ. The step-size formula finds when an inactive one first meets the shrinking tie. The geometry explains the name: u bisects the angles between the active features, the “least angle” direction.
LARS, lasso and stagewise. Efron et al. (2004) proved that:
- LARS with the drop rule gives the lasso path;
- infinitesimal forward stagewise gives a closely related path, with a monotonicity constraint on coefficient signs;
- the three coincide when coefficients never change sign.
Degrees of freedom. For the lasso, the number of non-zero coefficients is an unbiased estimate of the degrees of freedom (Zou, Hastie and Tibshirani, 2007), so Cp and AIC are easy along the path.
Limitations:
- numerically sensitive with highly collinear features;
- with p > n the path stops after n − 1 steps;
- not easily extended to elastic net or GLMs (use coordinate descent).
Compared with greedy selection: forward stepwise commits fully to each feature and can be too aggressive with correlated features. LARS shares credit gradually.
Interview questions.
- What is the “angle” in least angle regression? The direction of movement makes equal (least) angles with all active features.
- How is LARS related to boosting? Forward stagewise with tiny steps is linear-regression boosting (L2-boosting); LARS is its limit with exact step lengths.
- 1. Degrees of freedom of a lasso fit are estimated by…
- 2. Forward stagewise with infinitesimal steps is a form of…
- 3. A drawback of LARS is…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.Paths compared
History. Forward stagewise was used in the 1960s. Efron, Hastie, Johnstone and Tibshirani’s 2004 Annals of Statistics paper unified LARS, the lasso and stagewise regression. It appeared with discussion pieces and is one of the most cited statistics papers. Its connection to boosting (Friedman, 2001; Hastie et al., 2007) helped explain why boosting with small learning rates generalises.
Exercise 1.
- LARS reaches least squares in exactly p = 8 steps.
- At every breakpoint, the active features’ correlations with the residual are tied, and no inactive feature exceeds them.
- LARS-lasso coefficients equal coordinate-descent lasso solutions at the breakpoint λ values (0.0331 and 0.0069).
- Forward stagewise with ε = 0.005 ends within 0.1 of least squares.
Exercise 2: four paths on a sparse problem. Setup: n = 100, p = 40 correlated features (ρ = 0.6), 6 true coefficients, σ = 1; the best point on each path is chosen by validation error; means over 12 datasets.
| Path | Test MSE at best point | Features at best point | Path length |
|---|---|---|---|
| forward stepwise (greedy refits) | 1.135 | 6.5 | 40 |
| LARS | 1.205 | 16.2 | 41 |
| LARS-lasso | 1.205 | 16.2 | 42 |
| forward stagewise (ε = 0.05) | 1.208 | 18.1 | 201 (thinned) |
- LARS, LARS-lasso and stagewise trace nearly identical paths and reach the same accuracy, as the theory predicts.
- With a few strong signals, greedy forward stepwise is slightly more accurate and much sparser (6.5 features, close to the true 6): it fully refits each feature instead of shrinking.
- The shrinkage paths keep about 16 features, because shrinking the true coefficients lets small noise features in (as with the lasso, D1.6).
- With weaker, more numerous signals, the shrinkage paths usually overtake greedy selection, whose high variance then dominates.
LARS in AI, robotics and aerospace
- Exploratory sensor ranking: the entry order of features along the path ranks predictors by importance.
- Sparse regression in system identification: an exact path for moderate libraries of candidate terms.
- Boosting theory: stagewise fitting with small steps, the foundation of gradient boosting (D7).
- Compressed sensing: homotopy methods related to LARS for basis pursuit.
References
- B. Efron, T. Hastie, I. Johnstone, R. Tibshirani (2004). “Least angle regression.” Annals of Statistics 32(2).
- H. Zou, T. Hastie, R. Tibshirani (2007). “On the ‘degrees of freedom’ of the lasso.” Annals of Statistics 35(5).
- T. Hastie, J. Taylor, R. Tibshirani, G. Walther (2007). “Forward stagewise regression and the monotone lasso.” Electronic Journal of Statistics 1.
- M. R. Osborne, B. Presnell, B. A. Turlach (2000). “A new approach to variable selection in least squares problems.” IMA Journal of Numerical Analysis 20(3).
- J. H. Friedman (2001). “Greedy function approximation: a gradient boosting machine.” Annals of Statistics 29(5).