NLA-lib Explorer

Randomized Kaczmarz

Definition (Randomized Kaczmarz). For a real linear system, choose row i independently with probability proportional to its squared norm. Project the current iterate onto (\mathbf{A}\mathbf{x})_i=\mathbf{b}_i. If \mathbf{a}_i is the transpose of row i, the update is \mathbf{x}\leftarrow\mathbf{x}+\frac{\mathbf{b}_i-(\mathbf{A}\mathbf{x})_i}{\|\mathbf{a}_i\|_2^2}\mathbf{a}_i. A zero row leaves the iterate unchanged. Consistent, inconsistent, and rank-deficient systems have different guarantees.

Copy link

Results

Theorem (O(\|\mathbf{A}\|_{\mathsf{F}}^2\|\mathbf{A}^{+}\|_2^2\log(1/\varepsilon)) iterations suffice for randomized Kaczmarz to reach its horizon).

, for any right-hand side: there are absolute constants C, \varepsilon_0 > 0 such that for every \mathbf{x}_\star with \mathbf{x}_\star - \mathbf{x}_0 in the row space of \mathbf{A}, rows drawn independently from the squared-row-norm law, row i with probability \|\mathbf{a}_i\|^2/\|\mathbf{A}\|_{\mathsf{F}}^2 (\mathbf{a}_i the rows of \mathbf{A}), 0 < \varepsilon \le \varepsilon_0 and q \ge C\|\mathbf{A}\|_{\mathsf{F}}^2\|\mathbf{A}^{+}\|_2^2\log(1/\varepsilon), \mathbb{E}\|\mathbf{x}_\star - \mathsf{kaczmarzIterate}(\mathbf{A}, \iota, \mathbf{b}, \mathbf{x}_0, q)\|^2 \le \varepsilon\|\mathbf{x}_\star - \mathbf{x}_0\|^2 + \|\mathbf{A}^{+}\|_2^2\,\|\mathbf{b} - \mathbf{A}\mathbf{x}_\star\|^2\,. The constants come before every dimension. Proved from NLAlib.integral_norm_sub_kaczmarzIterate_sq_le_mul_add_of_hasLaw_iidSequence_of_mul_log_le with C = 1 and \varepsilon_0 = 1. [ZouziasFreris2013, Theorem 7]. Asymptotic: NLAlib.integral_norm_sub_kaczmarzIterate_sq_le_mul_add_of_hasLaw_iidSequence_of_mul_log_le

Lean statement and details
NLAlib.exists_forall_integral_norm_sub_kaczmarzIterate_sq_le_mul_add_of_hasLaw_iidSequence_of_mul_log_le :
  ∃ C ε₀,
    0 < C ∧
      0 < ε₀ ∧
        ∀ {Ω 𝕜 m n : Type} [inst : MeasurableSpace Ω] [inst_1 : RCLike 𝕜] [inst_2 : Fintype m]
          [inst_3 : Fintype n] [inst_4 : DecidableEq m] [inst_5 : MeasurableSpace m]
          [MeasurableSingletonClass m] (μ : Measure Ω) (A : Matrix m n 𝕜) (b : m → 𝕜)
          (ι : Ω → ℕ → m) (xs x₀ : n → 𝕜) (q : ℕ) (ε : ℝ),
          HasLaw ι (iidSequence (samplingMeasure (rowNormSqDistribution A))) μ →
            xs - x₀ ∈ Aᴴ.mulVecLin.range →
              0 < ε →
                ε ≤ ε₀ →
                  C * (frobPseudoConditionNumber A ^ 2 * Real.log (1 / ε)) ≤ ↑q →
                    ∫ (ω : Ω), ‖WithLp.toLp 2 (xs - kaczmarzIterate A (ι ω) b x₀ q)‖ ^ 2 ∂μ ≤
                      ε * ‖WithLp.toLp 2 (xs - x₀)‖ ^ 2 +
                        specNorm (pinv A) ^ 2 * ‖WithLp.toLp 2 (b - A *ᵥ xs)‖ ^ 2

Full source on GitHub

Copy link

Theorem (From any start, randomized Kaczmarz converges to the least-squares solution nearest the start, up to the horizon).

, for any right-hand side and with no hypothesis: with rows drawn independently from the squared-row-norm law, row i with probability \|\mathbf{a}_i\|^2/\|\mathbf{A}\|_{\mathsf{F}}^2 (\mathbf{a}_i the rows of \mathbf{A}), \mathbf{x}_\star = \mathbf{x}_0 + \mathbf{A}^{+}(\mathbf{b} - \mathbf{A}\mathbf{x}_0) and \rho = 1 - (\|\mathbf{A}\|_{\mathsf{F}}\|\mathbf{A}^{+}\|_2)^{-2}, \mathbb{E}\|\mathbf{x}_\star - \mathsf{kaczmarzIterate}(\mathbf{A}, \iota, \mathbf{b}, \mathbf{x}_0, q)\|^2 \le \rho^q\|\mathbf{A}^{+}(\mathbf{b} - \mathbf{A}\mathbf{x}_0)\|^2 + (1 - \rho^q)\,\|\mathbf{A}^{+}\|_2^2\,\|(\mathbf{I} - \mathbf{P}_{\mathbf{A}})\mathbf{b}\|^2\,. From \mathbf{x}_0 = \mathbf{0} the limit is \mathbf{A}^{+}\mathbf{b}. [ZouziasFreris2013, Theorem 7], there from \mathbf{x}_0 = \mathbf{0}; [LeventhalLewis2010, Theorem 4.7], there for consistent systems.

Lean statement and details
NLAlib.integral_norm_add_pinv_mulVec_sub_kaczmarzIterate_sq_le_of_hasLaw_iidSequence.{u_1, u_2, u_3,
    u_4}
  {𝕜 : Type u_1} [RCLike 𝕜] {m : Type u_2} {n : Type u_3} [Fintype m] [Fintype n] [DecidableEq m]
  {Ω : Type u_4} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} [MeasurableSpace m]
  [MeasurableSingletonClass m] {A : Matrix m n 𝕜} {b : m → 𝕜} {ι : Ω → ℕ → m}
  (hι : HasLaw ι (iidSequence (samplingMeasure (rowNormSqDistribution A))) μ) (x₀ : n → 𝕜) (q : ℕ) :
  ∫ (ω : Ω),
      ‖WithLp.toLp 2 (x₀ + pinv A *ᵥ (b - A *ᵥ x₀) - kaczmarzIterate A (ι ω) b x₀ q)‖ ^ 2 ∂μ ≤
    (1 - 1 / frobPseudoConditionNumber A ^ 2) ^ q * ‖WithLp.toLp 2 (pinv A *ᵥ (b - A *ᵥ x₀))‖ ^ 2 +
      (1 - (1 - 1 / frobPseudoConditionNumber A ^ 2) ^ q) * specNorm (pinv A) ^ 2 *
        ‖WithLp.toLp 2 ((1 - rangeProjector A) *ᵥ b)‖ ^ 2

Full source on GitHub

Copy link

Theorem (O(\|\mathbf{A}\|_{\mathsf{F}}^2\|\mathbf{A}^{+}\|_2^2\log(1/\varepsilon)) iterations suffice for randomized Kaczmarz).

there are absolute constants C, \varepsilon_0 > 0 such that for \mathbf{A}\mathbf{x}_\star = \mathbf{b}, \mathbf{x}_\star - \mathbf{x}_0 in the row space of \mathbf{A}, rows drawn independently from the squared-row-norm law, row i with probability \|\mathbf{a}_i\|^2/\|\mathbf{A}\|_{\mathsf{F}}^2 (\mathbf{a}_i the rows of \mathbf{A}), 0 < \varepsilon \le \varepsilon_0 and q \ge C\|\mathbf{A}\|_{\mathsf{F}}^2\|\mathbf{A}^{+}\|_2^2\log(1/\varepsilon), \mathbb{E}\|\mathbf{x}_\star - \mathsf{kaczmarzIterate}(\mathbf{A}, \iota, \mathbf{b}, \mathbf{x}_0, q)\|^2 \le \varepsilon\|\mathbf{x}_\star - \mathbf{x}_0\|^2\,. The constants come before every dimension. Proved from NLAlib.integral_norm_sub_kaczmarzIterate_sq_le_mul_of_hasLaw_iidSequence_of_mul_log_le with C = 1 and \varepsilon_0 = 1. [StrohmerVershynin2009, (11)], which counts 2\kappa(\mathbf{A})^2\log(1/\varepsilon) steps for the unsquared error. Asymptotic: NLAlib.integral_norm_sub_kaczmarzIterate_sq_le_mul_of_hasLaw_iidSequence_of_mul_log_le

Lean statement and details
NLAlib.exists_forall_integral_norm_sub_kaczmarzIterate_sq_le_of_hasLaw_iidSequence_of_mul_log_le :
  ∃ C ε₀,
    0 < C ∧
      0 < ε₀ ∧
        ∀ {Ω 𝕜 m n : Type} [inst : MeasurableSpace Ω] [inst_1 : RCLike 𝕜] [inst_2 : Fintype m]
          [inst_3 : Fintype n] [inst_4 : DecidableEq m] [inst_5 : MeasurableSpace m]
          [MeasurableSingletonClass m] (μ : Measure Ω) (A : Matrix m n 𝕜) (b : m → 𝕜)
          (ι : Ω → ℕ → m) (xs x₀ : n → 𝕜) (q : ℕ) (ε : ℝ),
          HasLaw ι (iidSequence (samplingMeasure (rowNormSqDistribution A))) μ →
            A *ᵥ xs = b →
              xs - x₀ ∈ Aᴴ.mulVecLin.range →
                0 < ε →
                  ε ≤ ε₀ →
                    C * (frobPseudoConditionNumber A ^ 2 * Real.log (1 / ε)) ≤ ↑q →
                      ∫ (ω : Ω), ‖WithLp.toLp 2 (xs - kaczmarzIterate A (ι ω) b x₀ q)‖ ^ 2 ∂μ ≤
                        ε * ‖WithLp.toLp 2 (xs - x₀)‖ ^ 2

Full source on GitHub

Copy link

Mathematical background

Appears under these tasks