Documentation

CslibFrontier.MachineLearning.LossMinimization.RLM

Regularized loss minimization #

The regularized loss minimization (RLM) rule with regularizer R : E → ℝ returns, on a sample S, a minimizer of L_S(w) + R(w) [ShalevShwartzBenDavid2014, Section 13.1]. With Tikhonov regularization R(w) = r‖w‖² (the source writes λ for r), convex ρ-Lipschitz losses and m examples, the rule is replace-one stable with rate ρ² / (r m). Combined with the general oracle inequality IsRLM.integral_trueRisk_le, this gives 𝔼_S [L_D(A S)] ≤ L_D(w) + r‖w‖² + 2ρ² / (r m) and, for comparators of norm at most B, the bound ρ B √(8 / m) on the excess risk.

The rule minimizes over a convex set K on which the losses are convex and Lipschitz; the source's convex-Lipschitz-bounded learning problems [ShalevShwartzBenDavid2014, Definition 12.12] take K to be the hypothesis class H, and the unconstrained rule takes K = Set.univ.

The stability rate is half of the rate 2ρ² / (r m) of [ShalevShwartzBenDavid2014, Corollary 13.6]: the source compares the two minimizers through the quadratic growth of one objective, while IsRLM.norm_sub_le adds the quadratic growth of both. The same rate follows from [BousquetElisseeff2002, Theorem 22], which bounds the effect of removing one example by ρ² / (2 r m) for losses that are ρ-Lipschitz in the prediction ⟪w, x⟫ and features of norm at most 1; a replacement is a removal followed by an insertion. The source's bounds follow, and are stated in the source's form.

Main definitions #

Main results #

References #

The rule #

structure Cslib.MachineLearning.IsRLM {E : Type u_1} {Z : Type u_2} (ℓ : E → Z → ℝ) (R : E → ℝ) (K : Set E) {m : ℕ} (A : (Fin m → Z) → E) :

A is a regularized loss minimization (RLM) rule on K for the loss ℓ and the regularizer R if, on every sample S, it returns a minimizer over K of the regularized empirical risk L_S(w) + R(w) [ShalevShwartzBenDavid2014, Section 13.1].

  • mem (S : Fin m → Z) : A S ∈ K

    The rule returns a point of K.

  • isMinOn (S : Fin m → Z) : IsMinOn (fun (w : E) => empiricalRisk ℓ S w + R w) K (A S)

    The rule minimizes the regularized empirical risk over K.

theorem Cslib.MachineLearning.IsRLM.le {E : Type u_1} {Z : Type u_2} {ℓ : E → Z → ℝ} {R : E → ℝ} {K : Set E} {m : ℕ} {A : (Fin m → Z) → E} (hA : IsRLM ℓ R K A) (S : Fin m → Z) {w : E} (hw : w ∈ K) :
empiricalRisk ℓ S (A S) + R (A S) ≤ empiricalRisk ℓ S w + R w

The regularized empirical risk of an RLM rule's output is at most that of any w ∈ K.

theorem Cslib.MachineLearning.exists_isRLM {E : Type u_1} {Z : Type u_2} [TopologicalSpace E] {ℓ : E → Z → ℝ} {R : E → ℝ} {K : Set E} (hK : IsCompact K) (hne : K.Nonempty) (hℓ : ∀ (z : Z), ContinuousOn (fun (w : E) => ℓ w z) K) (hR : ContinuousOn R K) (m : ℕ) :
∃ (A : (Fin m → Z) → E), IsRLM ℓ R K A

Existence of RLM rules on compact sets: if K is compact and nonempty, and the losses and the regularizer are continuous on K, some rule minimizes the regularized empirical risk.

theorem Cslib.MachineLearning.exists_isRLM_tikhonov {E : Type u_1} {Z : Type u_2} [NormedAddCommGroup E] [ProperSpace E] {ℓ : E → Z → ℝ} {K : Set E} (hK : IsClosed K) (hne : K.Nonempty) (hℓ : ∀ (z : Z), ContinuousOn (fun (w : E) => ℓ w z) K) {c : ℝ} (hc : ∀ w ∈ K, ∀ (z : Z), c ≤ ℓ w z) {r : ℝ} (hr : 0 < r) (m : ℕ) :
∃ (A : (Fin m → Z) → E), IsRLM ℓ (fun (w : E) => r * ‖w‖ ^ 2) K A

Existence of Tikhonov RLM rules: in a proper space, if K is closed and nonempty, the losses are continuous on K and bounded below by c there, and r > 0, some rule minimizes L_S(w) + r‖w‖² over K. Taking K = Set.univ gives the unconstrained rule.

Stability #

theorem Cslib.MachineLearning.IsRLM.mul_norm_sub_sq_le {E : Type u_1} {Z : Type u_2} [NormedAddCommGroup E] [NormedSpace ℝ E] {ℓ : E → Z → ℝ} {R : E → ℝ} {K : Set E} {m : ℕ} {A : (Fin m → Z) → E} (hA : IsRLM ℓ R K A) {σ : ℝ} (hR : StrongConvexOn K σ R) (hconv : ∀ (z : Z), ConvexOn ℝ K fun (w : E) => ℓ w z) (S : Fin m → Z) (i : Fin m) (z' : Z) :
σ * ↑m * ‖A (Function.update S i z') - A S‖ ^ 2 ≤ ℓ (A (Function.update S i z')) (S i) - ℓ (A S) (S i) + (ℓ (A S) z' - ℓ (A (Function.update S i z')) z')

Two-minimizer growth: if R is σ-strongly convex on K and every loss is convex on K, then the outputs u = A S and v = A S⁽ⁱ⁾ of an RLM rule on m examples satisfy σ m ‖v - u‖² ≤ (ℓ(v, z_i) - ℓ(u, z_i)) + (ℓ(u, z') - ℓ(v, z')), where S⁽ⁱ⁾ replaces the i-th example by z'. This adds the quadratic growth of both regularized empirical risks at their minimizers (compare [ShalevShwartzBenDavid2014, (13.10)], which uses one).

theorem Cslib.MachineLearning.IsRLM.norm_sub_le {E : Type u_1} {Z : Type u_2} [NormedAddCommGroup E] [NormedSpace ℝ E] {ℓ : E → Z → ℝ} {R : E → ℝ} {K : Set E} {m : ℕ} {A : (Fin m → Z) → E} (hA : IsRLM ℓ R K A) {σ : ℝ} (hσ : 0 < σ) (hR : StrongConvexOn K σ R) (hconv : ∀ (z : Z), ConvexOn ℝ K fun (w : E) => ℓ w z) {ρ : NNReal} (hlip : ∀ (z : Z), LipschitzOnWith ρ (fun (w : E) => ℓ w z) K) (S : Fin m → Z) (i : Fin m) (z' : Z) :
‖A (Function.update S i z') - A S‖ ≤ 2 * ↑ρ / (σ * ↑m)

RLM rules with a strongly convex regularizer are stable (compare [ShalevShwartzBenDavid2014, Corollary 13.6]): if R is σ-strongly convex on K with σ > 0 and every loss is convex and ρ-Lipschitz on K, then replacing one of m examples moves the output of an RLM rule by at most 2ρ / (σ m).

theorem Cslib.MachineLearning.IsRLM.sub_le {E : Type u_1} {Z : Type u_2} [NormedAddCommGroup E] [NormedSpace ℝ E] {ℓ : E → Z → ℝ} {R : E → ℝ} {K : Set E} {m : ℕ} {A : (Fin m → Z) → E} (hA : IsRLM ℓ R K A) {σ : ℝ} (hσ : 0 < σ) (hR : StrongConvexOn K σ R) (hconv : ∀ (z : Z), ConvexOn ℝ K fun (w : E) => ℓ w z) {ρ : NNReal} (hlip : ∀ (z : Z), LipschitzOnWith ρ (fun (w : E) => ℓ w z) K) (S : Fin m → Z) (i : Fin m) (z' z : Z) :
ℓ (A (Function.update S i z')) z - ℓ (A S) z ≤ 2 * ↑ρ ^ 2 / (σ * ↑m)

RLM rules with a strongly convex regularizer are uniformly stable: under the hypotheses of Cslib.MachineLearning.IsRLM.norm_sub_le, replacing one of m examples changes the loss of the output on every example by at most 2ρ² / (σ m).

theorem Cslib.MachineLearning.IsRLM.isReplaceOneStable {E : Type u_1} {Z : Type u_2} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace Z] {ℓ : E → Z → ℝ} {R : E → ℝ} {K : Set E} {m : ℕ} {A : (Fin m → Z) → E} (hA : IsRLM ℓ R K A) {σ : ℝ} (hσ : 0 < σ) (hR : StrongConvexOn K σ R) (hconv : ∀ (z : Z), ConvexOn ℝ K fun (w : E) => ℓ w z) {ρ : NNReal} (hlip : ∀ (z : Z), LipschitzOnWith ρ (fun (w : E) => ℓ w z) K) :
IsReplaceOneStable ℓ A (2 * ↑ρ ^ 2 / (σ * ↑m))

RLM rules with a σ-strongly convex regularizer and convex ρ-Lipschitz losses are replace-one stable with rate 2ρ² / (σ m).

The oracle inequality #

theorem Cslib.MachineLearning.IsRLM.integral_empiricalRisk_le {E : Type u_1} {Z : Type u_2} [MeasurableSpace Z] {ℓ : E → Z → ℝ} {R : E → ℝ} {K : Set E} {m : ℕ} {A : (Fin m → Z) → E} (hA : IsRLM ℓ R K A) (hR : ∀ w ∈ K, 0 ≤ R w) (D : MeasureTheory.Measure Z) [MeasureTheory.IsProbabilityMeasure D] (hm : 0 < m) (hint' : ∀ (i : Fin m), MeasureTheory.Integrable (fun (S : Fin m → Z) => ℓ (A S) (S i)) (MeasureTheory.Measure.pi fun (x : Fin m) => D)) {w : E} (hw : w ∈ K) (hwint : MeasureTheory.Integrable (ℓ w) D) :
(∫ (S : Fin m → Z), empiricalRisk ℓ S (A S) ∂MeasureTheory.Measure.pi fun (x : Fin m) => D) ≤ trueRisk ℓ D w + R w

The fitting term of the oracle inequality [ShalevShwartzBenDavid2014, (13.16)]: for an RLM rule on K with a regularizer that is nonnegative on K, m > 0 i.i.d. examples from D and every w ∈ K with D-integrable loss, 𝔼_S [L_S(A S)] ≤ L_D(w) + R(w).

theorem Cslib.MachineLearning.IsRLM.integral_trueRisk_le {E : Type u_1} {Z : Type u_2} [MeasurableSpace Z] {ℓ : E → Z → ℝ} {R : E → ℝ} {K : Set E} {m : ℕ} {A : (Fin m → Z) → E} (hA : IsRLM ℓ R K A) (hR : ∀ w ∈ K, 0 ≤ R w) {ε : ℝ} (hstab : IsReplaceOneStable ℓ A ε) (D : MeasureTheory.Measure Z) [MeasureTheory.IsProbabilityMeasure D] (hm : 0 < m) (hint : MeasureTheory.Integrable (fun (p : (Fin m → Z) × Z) => ℓ (A p.1) p.2) ((MeasureTheory.Measure.pi fun (x : Fin m) => D).prod D)) (hint' : ∀ (i : Fin m), MeasureTheory.Integrable (fun (S : Fin m → Z) => ℓ (A S) (S i)) (MeasureTheory.Measure.pi fun (x : Fin m) => D)) {w : E} (hw : w ∈ K) (hwint : MeasureTheory.Integrable (ℓ w) D) :
(∫ (S : Fin m → Z), trueRisk ℓ D (A S) ∂MeasureTheory.Measure.pi fun (x : Fin m) => D) ≤ trueRisk ℓ D w + R w + ε

The oracle inequality for stable RLM rules [ShalevShwartzBenDavid2014, (13.15) and (13.16)]: if an RLM rule on K with a regularizer that is nonnegative on K is replace-one stable at rate ε, then for m > 0 i.i.d. examples from D and every w ∈ K with D-integrable loss, 𝔼_S [L_D(A S)] ≤ L_D(w) + R(w) + ε. The integrability hypotheses are those of Cslib.MachineLearning.integral_trueRisk_sub_empiricalRisk.

theorem Cslib.MachineLearning.IsRLM.isReplaceOneStable_tikhonov {E : Type u_1} {Z : Type u_2} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [MeasurableSpace Z] {ℓ : E → Z → ℝ} {K : Set E} {m : ℕ} {r : ℝ} {A : (Fin m → Z) → E} (hA : IsRLM ℓ (fun (w : E) => r * ‖w‖ ^ 2) K A) (hK : Convex ℝ K) (hr : 0 < r) (hconv : ∀ (z : Z), ConvexOn ℝ K fun (w : E) => ℓ w z) {ρ : NNReal} (hlip : ∀ (z : Z), LipschitzOnWith ρ (fun (w : E) => ℓ w z) K) :
IsReplaceOneStable ℓ A (↑ρ ^ 2 / (r * ↑m))

Tikhonov RLM is stable [ShalevShwartzBenDavid2014, Corollary 13.6]: for the regularizer r‖w‖² with r > 0 on a convex set K and convex ρ-Lipschitz losses, an RLM rule on m examples is replace-one stable with rate ρ² / (r m). This is half the rate 2ρ² / (r m) of the source, which follows by Cslib.MachineLearning.IsReplaceOneStable.mono.

theorem Cslib.MachineLearning.IsRLM.integral_trueRisk_le_tikhonov {E : Type u_1} {Z : Type u_2} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [MeasurableSpace Z] {ℓ : E → Z → ℝ} {K : Set E} {m : ℕ} {r : ℝ} {A : (Fin m → Z) → E} (hA : IsRLM ℓ (fun (w : E) => r * ‖w‖ ^ 2) K A) (hK : Convex ℝ K) (hr : 0 < r) (hconv : ∀ (z : Z), ConvexOn ℝ K fun (w : E) => ℓ w z) {ρ : NNReal} (hlip : ∀ (z : Z), LipschitzOnWith ρ (fun (w : E) => ℓ w z) K) (D : MeasureTheory.Measure Z) [MeasureTheory.IsProbabilityMeasure D] (hm : 0 < m) (hint : MeasureTheory.Integrable (fun (p : (Fin m → Z) × Z) => ℓ (A p.1) p.2) ((MeasureTheory.Measure.pi fun (x : Fin m) => D).prod D)) (hint' : ∀ (i : Fin m), MeasureTheory.Integrable (fun (S : Fin m → Z) => ℓ (A S) (S i)) (MeasureTheory.Measure.pi fun (x : Fin m) => D)) {w : E} (hw : w ∈ K) (hwint : MeasureTheory.Integrable (ℓ w) D) :
(∫ (S : Fin m → Z), trueRisk ℓ D (A S) ∂MeasureTheory.Measure.pi fun (x : Fin m) => D) ≤ trueRisk ℓ D w + r * ‖w‖ ^ 2 + 2 * ↑ρ ^ 2 / (r * ↑m)

The oracle inequality for Tikhonov RLM [ShalevShwartzBenDavid2014, Corollary 13.8]: for the regularizer r‖w‖² with r > 0 on a convex set K, convex ρ-Lipschitz losses and m > 0 i.i.d. examples from D, every w ∈ K with D-integrable loss satisfies 𝔼_S [L_D(A S)] ≤ L_D(w) + r‖w‖² + 2ρ² / (r m).

The rate 2ρ² / (r m) is the source's; the proof gives ρ² / (r m). The comparator w ranges over K, the set the rule minimizes over; the source takes K to be the whole space. The integrability hypotheses are those of Cslib.MachineLearning.integral_trueRisk_sub_empiricalRisk.

theorem Cslib.MachineLearning.IsRLM.integral_trueRisk_le_add_sqrt {E : Type u_1} {Z : Type u_2} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [MeasurableSpace Z] {ℓ : E → Z → ℝ} {K : Set E} {m : ℕ} {r : ℝ} {A : (Fin m → Z) → E} (hA : IsRLM ℓ (fun (w : E) => r * ‖w‖ ^ 2) K A) (hK : Convex ℝ K) (hconv : ∀ (z : Z), ConvexOn ℝ K fun (w : E) => ℓ w z) {ρ : NNReal} (hlip : ∀ (z : Z), LipschitzOnWith ρ (fun (w : E) => ℓ w z) K) {B : ℝ} (hρ : 0 < ↑ρ) (hB : 0 < B) (hr : r = √(2 * ↑ρ ^ 2 / (B ^ 2 * ↑m))) (D : MeasureTheory.Measure Z) [MeasureTheory.IsProbabilityMeasure D] (hm : 0 < m) (hint : MeasureTheory.Integrable (fun (p : (Fin m → Z) × Z) => ℓ (A p.1) p.2) ((MeasureTheory.Measure.pi fun (x : Fin m) => D).prod D)) (hint' : ∀ (i : Fin m), MeasureTheory.Integrable (fun (S : Fin m → Z) => ℓ (A S) (S i)) (MeasureTheory.Measure.pi fun (x : Fin m) => D)) {w : E} (hw : w ∈ K) (hwB : ‖w‖ ≤ B) (hwint : MeasureTheory.Integrable (ℓ w) D) :
(∫ (S : Fin m → Z), trueRisk ℓ D (A S) ∂MeasureTheory.Measure.pi fun (x : Fin m) => D) ≤ trueRisk ℓ D w + ↑ρ * B * √(8 / ↑m)

Convex-Lipschitz-bounded problems [ShalevShwartzBenDavid2014, Corollary 13.9]: for convex ρ-Lipschitz losses on a convex set K with ρ > 0, a bound B > 0, m > 0 i.i.d. examples from D and the regularization weight r = √(2ρ² / (B² m)), Tikhonov RLM satisfies 𝔼_S [L_D(A S)] ≤ L_D(w) + ρ B √(8 / m) for every w ∈ K with ‖w‖ ≤ B and integrable loss. The source states this against min_{w ∈ H} L_D(w); the form here holds for every comparator, so it bounds the infimum without assuming that it is attained. Combining IsRLM.integral_trueRisk_le with the rate ρ² / (r m) of IsRLM.isReplaceOneStable_tikhonov instead, the weight r = ρ / (B √m) gives the smaller excess 2 ρ B / √m.