ML.Lasso
Roll-up of the lasso family: l1penalty, lassoObjective, convexity of the finite objective, the scalar soft-thresholding optimality theorem softThreshold_isMinOn, and the Rademacher-complexity and squared-loss excess-risk
Finite 4 core · 3 supporting The lasso objective is least squares plus the non-smooth convex penalty λ‖β‖₁ = λ ∑ₖ |βₖ|. ★ softThreshold★ convexOn_l1penalty
Lasso — L1-regularized least squares (definitions + convexity)
The lasso objective is least squares plus the non-smooth convex penalty
λ‖β‖₁ = λ ∑ₖ |βₖ|. This file defines l1penalty, lassoObjective, and
softThreshold, and proves the nonnegativity and convexity facts needed by the
finite lasso objective. The scalar soft-thresholding optimality theorem is in
Lasso/Optimality.lean.
The L1 penalty ‖β‖₁ = ∑ₖ |βₖ|.
Definition (Lean source)
The lasso objective: least-squares error plus the L1 penalty λ‖β‖₁.
Definition (Lean source)
The soft-thresholding operator, in the sign-free form S_λ(z) = max(z − λ, 0) − max(−z − λ, 0) (equal to sign z · max(|z| − λ, 0)).
Definition (Lean source)
The L1 penalty is convex as a function of the coefficient vector.
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
l1penalty_nonnegtheorem — The L1 penalty is nonnegative.Proof (Lean source)
-
convexOn_olsObjectivetheorem — The least-squares objective is convex in the coefficients.Proof (Lean source)
theorem convexOn_olsObjective (X : Matrix Obs Param ℝ) (y : Obs → ℝ) : ConvexOn ℝ univ (olsObjective X y) := by classical unfold olsObjective let lin : Obs → ((Param → ℝ) →ₗ[ℝ] ℝ) := fun i => { toFun := fun β => (X *ᵥ β) i map_add' := by intro β γ simp [Matrix.mulVec_add] map_smul' := by intro c β simp [Matrix.mulVec_smul] } let aff : Obs → ((Param → ℝ) →ᵃ[ℝ] ℝ) := fun i => { toFun := fun β => y i - (X *ᵥ β) i linear := -lin i map_vadd' := by intro β δ simp only [vadd_eq_add] rw [Matrix.mulVec_add] simp [lin] ring } have hsquare : ConvexOn ℝ univ (fun t : ℝ => t ^ 2) := by simpa using (show Even 2 from by decide).convexOn_pow (𝕜 := ℝ) have hsummand : ∀ i : Obs, ConvexOn ℝ univ (fun β : Param → ℝ => (y i - (X *ᵥ β) i) ^ 2) := by intro i simpa [Function.comp_def, aff] using hsquare.comp_affineMap (aff i) have hfin : ∀ t : Finset Obs, ConvexOn ℝ univ (fun β : Param → ℝ => t.sum fun i => (y i - (X *ᵥ β) i) ^ 2) := by intro t induction t using Finset.induction_on with | empty => simpa using (convexOn_const (𝕜 := ℝ) (E := Param → ℝ) (β := ℝ) (s := univ) (0 : ℝ) convex_univ) | insert i t hi ht => simp only [Finset.sum_insert hi] exact (hsummand i).add ht simpa using hfin univ -
convexOn_lassoObjectivetheorem — The lasso objective is convex for λ ≥ 0.hypothesesconclusionProof (Lean source)
theorem convexOn_lassoObjective (X : Matrix Obs Param ℝ) (y : Obs → ℝ) {lam : ℝ} (hlam : 0 ≤ lam) : ConvexOn ℝ univ (lassoObjective X y lam) := by unfold lassoObjective exact (convexOn_olsObjective X y).add ((convexOn_l1penalty (Param := Param)).smul hlam)
Optimality 1 core · 0 supporting The scalar soft-thresholding identity: S_λ(a) is the exact minimizer of the one-dimensional penalized objective (u − a)² + 2λ|u|. ★ softThreshold_isMinOn
Lasso — soft-thresholding closed form
The scalar soft-thresholding identity: S_λ(a) is the exact minimizer of the
one-dimensional penalized objective (u − a)² + 2λ|u|. This is the per-coordinate
proximal step that underlies closed-form lasso calculations in orthonormal
coordinates.
For a real number a, if the regularization level lam is nonnegative, then the soft-thresholded value softThreshold lam a minimizes the one-dimensional penalized least-squares objective u ↦ (u − a)² + 2·lam·|u| over every real u.
Formal statement
Proof (Lean source)
Rate 2 core · 0 supporting The statistical rate for empirical risk minimization over an L¹-norm-bounded class of linear predictors a ↦ ∑ⱼ wⱼ aⱼ (the lasso constraint set). ★ rademacherComplexity_l1_ball_le★ lasso_erm_excess_rate
Lasso / L¹-ball linear predictors — Rademacher rate
The statistical rate for empirical risk minimization over an L¹-norm-bounded class of
linear predictors a ↦ ∑ⱼ wⱼ aⱼ (the lasso constraint set). Over L∞-bounded features,
the Rademacher complexity of the L¹-ball class carries the characteristic √(log d)
dimension factor: ≤ (X∞·W/√n)·√(2 log 2d). Combined with the generic ERM oracle
inequality this gives the O(√(log d / n)) excess-risk rate that distinguishes lasso in
high dimensions.
Built on FoML's linear_predictor_l1_bound' (Massart finite-class bound for the L¹-ball,
lifted here to the expected rademacherComplexity).
Rademacher complexity of the L¹-ball linear class. If the dimension d is positive, the sample size n is positive, the coordinatewise feature bound Xinf is nonnegative, the weight bound W is nonnegative, and every feature coordinate is bounded in absolute value by Xinf, then the expected Rademacher complexity of the class of linear predictors with L¹ weight norm at most W is at most (Xinf·W/√n)·√(2 log 2d).
Formal statement
Proof (Lean source)
Lasso ERM excess-risk rate over the L¹ ball. For linear predictors indexed by the L¹ ball, if the dimension d is positive, the sample size n is positive, the coordinatewise feature bound Xinf is nonnegative, the weight bound W is nonnegative, the feature map X is measurable, the constant t satisfies the calibration t·(Xinf·W)² ≤ 1/2, the tolerance ε is nonnegative, and the estimator ŵ attains empirical risk no larger than that of the comparator wstar, then the probability that the excess population risk of ŵ over wstar exceeds 4·(Xinf·W/√n)·√(2 log 2d) + 2ε is at most exp(-ε²tn).
Formal statement
Proof (Lean source)
SquaredLoss 3 core · 0 supporting The genuine squared-loss statistical rate for empirical risk minimization over an L¹-norm-bounded class of linear predictors a ↦ ∑ⱼ wⱼ aⱼ. ★ lasso_erm_squaredLoss_excess_rate
Lasso / L¹-ball linear predictors — squared-loss excess-risk rate
The genuine squared-loss statistical rate for empirical risk minimization over an
L¹-norm-bounded class of linear predictors a ↦ ∑ⱼ wⱼ aⱼ. Features are
L∞-bounded and responses are bounded, so the rate carries the lasso
√(2 log 2d) dimension factor.
The Rademacher complexity of the squared-loss class is bounded by decomposing the
centered loss (∑ⱼ wⱼxⱼ - y)² - y² = (∑ⱼ wⱼxⱼ)² - 2y∑ⱼ wⱼxⱼ:
* the quadratic part is handled by the infinite-index Ledoux--Talagrand contraction
with the clamped square as the Lipschitz surrogate, reducing to the lasso linear-class
bound;
* the cross part 2y∑ⱼ wⱼxⱼ is itself a lasso linear class over the rescaled
L∞-bounded features 2y·x.
Combined with the generic ERM oracle inequality (erm_oracle_inequality_separable) this
gives the O(√(log d / n)) squared-loss excess-risk rate
lasso_erm_squaredLoss_excess_rate.
Feature × response data space: Xinf-bounded coordinates paired with [-Yb,Yb] responses.
Definition (Lean source)
The W-ball of weight vectors in coordinate ℓ¹ norm.
Definition (Lean source)
Lasso ERM squared-loss excess-risk rate over the L¹ ball. For data pairing coordinatewise-bounded features with bounded responses, and predictors indexed by the coordinate L¹ ball of radius W, if the dimension d is positive, the sample size n is positive, the coordinatewise feature bound Xinf is nonnegative, the response bound Yb is nonnegative, the weight bound W is nonnegative, the feature coordinate map is measurable, the response coordinate map is measurable, the constant t satisfies the calibration t·((Xinf·W)² + 2·Yb·Xinf·W)² ≤ 1/2, the tolerance ε is nonnegative, and the estimator ŵ attains empirical squared loss no larger than that of the comparator wstar, then for the squared regression loss (∑ⱼ wⱼxⱼ - y)², the probability that the excess population risk of ŵ over wstar exceeds 4·((4(XinfW)² + 2·Yb·Xinf·W)/√n)·√(2 log 2d) + 2ε is at most exp(-ε²tn).