Stat.Nonparametric.HistogramRegression
This roll-up exports totalized finite-partition regression histograms, their integrated iid squared-risk bound, and the Hölder cubical specialization with an optimized ceiling-mesh rate.
Basic 10 core · 3 supporting A finite measurable label map represents a partition: its fibers are disjoint and cover the covariate space. ★ cellEstimate_mem_Icc
Totalized finite-partition regression histograms
A finite measurable label map represents a partition: its fibers are disjoint
and cover the covariate space. Empty and zero-mass fibers are allowed. Samples
are tuples of observations, whose covariates and responses are supplied by maps.
The estimator clips the empirical response average to [0,1] and uses a fixed
default when the observed cell count is zero, including sample size zero.
Reference for the estimator and integrated marginal loss: A. Nobel, Histogram Regression Estimation Using Data-dependent Partitions, Ann. Statist. 24 (1996), 1084–1105, equations (1)–(2), https://nobel.web.unc.edu/wp-content/uploads/sites/13591/2017/01/histreg.pdf. Here partitions are deterministic, and the empty-cell default is arbitrary.
The cell with label is the inverse image under the partition map of that label after applying the covariate map.
Definition (Lean source)
The cell probability is the real mass under the observation law of the cell specified by the partition, covariate map, and label.
The sample cell count counts entries of the sample whose covariates have the specified partition label.
Definition (Lean source)
The cell response sum sums responses in the sample over the cell specified by the partition, covariate map, and label.
Clipping maps a real input to its nearest point in [0,1].
The cell estimate clips the empirical average of responses in a sample within the specified covariate partition cell, and returns the fixed default when the cell is empty.
Definition (Lean source)
The histogram prediction at a query covariate is the cell estimate using the partition, covariates, responses, default, and sample.
Definition (Lean source)
The expected integrated squared risk averages squared prediction error against the target, integrating a fresh covariate drawn from the observation law and training samples drawn from the sample law, using the partition, covariates, responses, and default.
The positive-mass labels retain precisely those cells of the partition and covariate map with positive mass under the law.
A default value in the unit interval ensures that every cell estimate belongs to the unit interval.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
measurable_cellCounttheorem — Measurable covariates and partition labels give measurable cell counts.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕlabel :A → κX :Ω → Ak :κhlabel :Measurable labelhX :conclusionMeasurable (cellCount (m := m) label X k)Proof (Lean source)
@[fun_prop] theorem measurable_cellCount {m : ℕ} (label : A → κ) (X : Ω → A) (k : κ) (hlabel : Measurable label) (hX : Measurable X) : Measurable (cellCount (m := m) label X k) := by classical have hsum : Measurable (fun z : Fin m → Ω => ∑ r : Fin m, if label (X (z r)) = k then (1 : ℕ) else 0) := by apply Finset.measurable_fun_sum intro r _ exact Measurable.ite ((measurableSet_singleton k).preimage (hlabel.comp (hX.comp (measurable_pi_apply r)))) measurable_const measurable_const change Measurable (fun z : Fin m → Ω => (Finset.univ.filter fun r => label (X (z r)) = k).card) simpa only [Finset.card_filter] using hsum -
measurable_cellEstimatetheorem — Measurable covariates, responses, and labels give measurable cell estimates, for every fixed default and cell.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕlabel :A → κX :Ω → AY :Ω → ℝa :ℝk :κhlabel :Measurable labelhX :hY :conclusionMeasurable (cellEstimate (m := m) label X Y a k)Proof (Lean source)
@[fun_prop] theorem measurable_cellEstimate {m : ℕ} (label : A → κ) (X : Ω → A) (Y : Ω → ℝ) (a : ℝ) (k : κ) (hlabel : Measurable label) (hX : Measurable X) (hY : Measurable Y) : Measurable (cellEstimate (m := m) label X Y a k) := by classical have hcount := measurable_cellCount (m := m) label X k hlabel hX have hsum : Measurable (cellSum (m := m) label X Y k) := by unfold cellSum apply Finset.measurable_fun_sum intro r _ exact Measurable.ite ((measurableSet_singleton k).preimage (hlabel.comp (hX.comp (measurable_pi_apply r)))) (hY.comp (measurable_pi_apply r)) measurable_const have hcast : Measurable (fun z : Fin m → Ω => (cellCount label X k z : ℝ)) := (measurable_of_countable (fun n : ℕ => (n : ℝ))).comp hcount unfold cellEstimate clip exact Measurable.ite ((measurableSet_singleton 0).preimage hcount) measurable_const (measurable_const.max (measurable_const.min (hsum.div hcast))) -
measurable_histogramtheorem — Measurable covariates, responses, and labels give jointly measurable histogram predictions in the sample and query.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕlabel :A → κX :Ω → AY :Ω → ℝa :ℝhlabel :Measurable labelhX :hY :conclusionProof (Lean source)
@[fun_prop] theorem measurable_histogram {m : ℕ} (label : A → κ) (X : Ω → A) (Y : Ω → ℝ) (a : ℝ) (hlabel : Measurable label) (hX : Measurable X) (hY : Measurable Y) : Measurable (fun q : (Fin m → Ω) × A => histogram label X Y a q.1 q.2) := by classical let _ := Fintype.ofFinite κ have hsum : Measurable (fun q : (Fin m → Ω) × A => ∑ k : κ, if label q.2 = k then cellEstimate label X Y a k q.1 else 0) := by apply Finset.measurable_fun_sum intro k _ exact Measurable.ite ((measurableSet_singleton k).preimage (hlabel.comp measurable_snd)) ((measurable_cellEstimate label X Y a k hlabel hX hY).comp measurable_fst) measurable_const simpa [histogram] using hsum
Population 3 core · 4 supporting The conditional-mean premise is the defining set-integral characterization of E[Y | X] = g(X), together with integrability. ★ cell_bias_le
Regression cell means and oscillation bias
The conditional-mean premise is the defining set-integral characterization of
E[Y | X] = g(X), together with integrability. It asks only for a population
regression identity, never for any sample-risk or rate estimate. A separate
bridge accepts Mathlib's conditional expectation on the sigma algebra generated
by X. Boundedness of the regression representative is derived almost surely.
The conditional-mean relation for the observation law, covariates, responses, and regression function says both responses and fitted population values are integrable and have equal integrals on every covariate-measurable event.
Definition (Lean source)
The population cell mean averages responses under the observation law within the specified partition cell, totalizing to zero at zero cell mass.
Definition (Lean source)
Measurable inputs, bounded responses, the conditional-mean relation, and a nonnegative within-cell oscillation envelope imply the integrated squared cell bias is at most cell mass times the squared envelope.
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
conditionalMean_of_condExptheorem — A conditional-expectation equality for measurable covariates and integrable responses implies the conditional-mean relation.hypothesesΩ :sharedType u_1A :sharedType u_2μ :X :Ω → AY :Ω → ℝg :A → ℝhX :hY :Integrable Y μhcond :μ[Y | comap X inferInstance] =ᵐ[μ] fun ω => g (X ω)conclusionConditionalMean μ X Y gProof (Lean source)
theorem conditionalMean_of_condExp (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → A) (Y : Ω → ℝ) (g : A → ℝ) (hX : Measurable X) (hY : Integrable Y μ) (hcond : μ[Y | comap X inferInstance] =ᵐ[μ] fun ω => g (X ω)) : ConditionalMean μ X Y g := by have hm : comap X inferInstance ≤ (inferInstance : MeasurableSpace Ω) := hX.comap_le refine ⟨hY, integrable_condExp.congr hcond, ?_⟩ intro s hs have hs' : MeasurableSet[comap X inferInstance] (X ⁻¹' s) := ⟨s, hs, rfl⟩ calc (∫ ω in X ⁻¹' s, Y ω ∂μ) = ∫ ω in X ⁻¹' s, (μ[Y | comap X inferInstance]) ω ∂μ := (setIntegral_condExp hm hY hs').symm _ = ∫ ω in X ⁻¹' s, g (X ω) ∂μ := integral_congr_ae (ae_restrict_of_ae hcond) -
regression_mem_Icc_aetheorem — Measurable covariates and regression function, unit-interval responses, and the conditional-mean relation imply that the regression function is almost surely in the unit interval.hypothesesΩ :sharedType u_1A :sharedType u_2μ :X :Ω → AY :Ω → ℝg :A → ℝhX :hg :hY :∀ᵐ ω ∂μ, Y ω ∈ Icc (0 : ℝ) 1hmean :ConditionalMean μ X Y gconclusion∀ᵐ ω ∂μ, g (X ω) ∈ Icc (0 : ℝ) 1Proof (Lean source)
theorem regression_mem_Icc_ae (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → A) (Y : Ω → ℝ) (g : A → ℝ) (hX : Measurable X) (hg : Measurable g) (hY : ∀ᵐ ω ∂μ, Y ω ∈ Icc (0 : ℝ) 1) (hmean : ConditionalMean μ X Y g) : ∀ᵐ ω ∂μ, g (X ω) ∈ Icc (0 : ℝ) 1 := by have nonneg_of_test (f : A → ℝ) (hf : Measurable f) (hfi : Integrable (fun ω => f (X ω)) μ) (htest : 0 ≤ ∫ ω in X ⁻¹' {x | f x < 0}, f (X ω) ∂μ) : ∀ᵐ ω ∂μ, 0 ≤ f (X ω) := by have hs : MeasurableSet (X ⁻¹' {x | f x < 0}) := (measurableSet_lt hf measurable_const).preimage hX have hn : ∀ᵐ ω ∂μ.restrict (X ⁻¹' {x | f x < 0}), 0 ≤ -f (X ω) := by filter_upwards [ae_restrict_mem hs] with ω hω exact neg_nonneg.mpr (le_of_lt hω) have hz : (∫ ω in X ⁻¹' {x | f x < 0}, -f (X ω) ∂μ) = 0 := by rw [integral_neg] have hp := integral_nonneg_of_ae hn rw [integral_neg] at hp linarith have he := (integral_eq_zero_iff_of_nonneg_ae hn hfi.integrableOn.neg).mp hz have he' := (ae_restrict_iff' hs).mp he filter_upwards [he'] with ω hω by_contra h have hh := hω (lt_of_not_ge h) change -f (X ω) = 0 at hh linarith have hlo : ∀ᵐ ω ∂μ, 0 ≤ g (X ω) := by apply nonneg_of_test g hg hmean.2.1 rw [← hmean.2.2 _ (measurableSet_lt hg measurable_const)] exact setIntegral_nonneg_of_ae (hY.mono fun ω hω => hω.1) have hhi : ∀ᵐ ω ∂μ, 0 ≤ 1 - g (X ω) := by apply nonneg_of_test (fun x => 1 - g x) (measurable_const.sub hg) ((integrable_const 1).sub hmean.2.1) rw [integral_sub (integrable_const 1) hmean.2.1.integrableOn, ← hmean.2.2 {x | 1 - g x < 0} (measurableSet_lt (show Measurable (fun x : A => (1 : ℝ) - g x) from measurable_const.sub hg) measurable_const)] exact sub_nonneg.mpr (integral_mono_ae hmean.1.integrableOn (integrable_const 1) (ae_restrict_of_ae (hY.mono fun ω hω => hω.2))) filter_upwards [hlo, hhi] with ω hlo hhi exact ⟨hlo, by linarith⟩ -
cellMean_eq_regressiontheorem — Measurable partition labels and the conditional-mean relation imply that the response cell mean equals the regression cell mean.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3μ :Measure Ωlabel :A → κX :Ω → AY :Ω → ℝg :A → ℝk :κhlabel :Measurable labelhmean :ConditionalMean μ X Y gconclusioncellMean μ label X Y k = cellMean μ label X (fun ω => g (X ω)) kProof (Lean source)
theorem cellMean_eq_regression (μ : Measure Ω) (label : A → κ) (X : Ω → A) (Y : Ω → ℝ) (g : A → ℝ) (k : κ) (hlabel : Measurable label) (hmean : ConditionalMean μ X Y g) : cellMean μ label X Y k = cellMean μ label X (fun ω => g (X ω)) k := by unfold cellMean congr 1 exact hmean.2.2 (label ⁻¹' {k}) ((measurableSet_singleton k).preimage hlabel) -
cellMean_mem_Icctheorem — Measurable responses and bounded responses ensure the totalized population cell mean belongs to the unit interval.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3μ :label :A → κX :Ω → AY :Ω → ℝk :κhYm :hY :∀ᵐ ω ∂μ, Y ω ∈ Icc (0 : ℝ) 1conclusioncellMean μ label X Y k ∈ Icc (0 : ℝ) 1Proof (Lean source)
theorem cellMean_mem_Icc (μ : Measure Ω) [IsProbabilityMeasure μ] (label : A → κ) (X : Ω → A) (Y : Ω → ℝ) (k : κ) (hYm : Measurable Y) (hY : ∀ᵐ ω ∂μ, Y ω ∈ Icc (0 : ℝ) 1) : cellMean μ label X Y k ∈ Icc (0 : ℝ) 1 := by have hi : Integrable Y μ := (integrable_const (1 : ℝ)).mono' hYm.aestronglyMeasurable (hY.mono fun ω hω => by simpa [Real.norm_eq_abs, abs_of_nonneg hω.1] using hω.2) have hm : 0 ≤ cellMass μ label X k := ENNReal.toReal_nonneg by_cases hz : cellMass μ label X k = 0 · simp [cellMean, hz] · have hp : 0 < cellMass μ label X k := lt_of_le_of_ne hm (Ne.symm hz) refine ⟨div_nonneg (setIntegral_nonneg_of_ae (hY.mono fun ω hω => hω.1)) hm, ?_⟩ change (∫ ω in cell label X k, Y ω ∂μ) / cellMass μ label X k ≤ 1 apply (div_le_iff₀ hp).mpr have hle := integral_mono_ae (μ := μ.restrict (cell label X k)) hi.integrableOn (integrable_const (1 : ℝ)) (ae_restrict_of_ae (hY.mono fun ω hω => hω.2)) simpa [setIntegral_const, cellMass, Measure.real] using hle
Mesh 3 core · 5 supporting Use max 1 (ceil (1/b)) bins along each axis. ★ optimized_mesh_variance_le
Ceiling meshes and optimized regression bandwidth algebra
Use max 1 (ceil (1/b)) bins along each axis. For 0<b≤1 its reciprocal
lies between b/2 and b, and its d-dimensional cell count is at most
(2/b)^d. The optimized positive-sample bandwidth is m^(-1/(2β+d)).
All the real-power and ceiling comparisons needed by the statistical theorem
are isolated here and make no probabilistic assumptions.
The number of bins per coordinate for bandwidth is the ceiling of its reciprocal, with at least one bin for every real input.
Definition (Lean source)
The optimized bandwidth for dimension, smoothness exponent, and sample size is the sample size raised to -1/(2β+d).
Definition (Lean source)
Positive smoothness and sample size give the bound 2^d · m^(-2β/(2β+d)) on the variance term: the number of cubical cells at the optimized bandwidth divided by the sample size plus one.
Formal statement
Proof (Lean source)
5 supporting declarations (lemmas, instances)
-
meshCount_postheorem — The ceiling mesh count is positive for every bandwidth.Proof (Lean source)
theorem meshCount_pos (b : ℝ) : 0 < meshCount b := by exact lt_of_lt_of_le Nat.zero_lt_one (le_max_left _ _) -
mesh_boundstheorem — A bandwidth in (0,1] gives the reciprocal mesh-width comparison and ceiling cell-count bound.hypothesesb :ℝhb :0 < bhb1 :b ≤ 1conclusionconclusion 1b / 2 ≤ (meshCount b : ℝ)⁻¹conclusion 2(meshCount b : ℝ)⁻¹ ≤ bconclusion 3(meshCount b : ℝ) ≤ 2 / bProof (Lean source)
theorem mesh_bounds (b : ℝ) (hb : 0 < b) (hb1 : b ≤ 1) : b / 2 ≤ (meshCount b : ℝ)⁻¹ ∧ (meshCount b : ℝ)⁻¹ ≤ b ∧ (meshCount b : ℝ) ≤ 2 / b := by have hi : 0 < b⁻¹ := inv_pos.mpr hb have hcount : meshCount b = ⌈b⁻¹⌉₊ := max_eq_right (Nat.one_le_ceil_iff.mpr hi) have hpos : 0 < (meshCount b : ℝ) := by exact_mod_cast meshCount_pos b have hlo : b⁻¹ ≤ (meshCount b : ℝ) := by rw [hcount] exact Nat.le_ceil _ have hup : (meshCount b : ℝ) ≤ 2 / b := by have hceil := (Nat.ceil_lt_add_one hi.le).le have hone : 1 ≤ b⁻¹ := (one_le_inv₀ hb).mpr hb1 rw [hcount, div_eq_mul_inv] linarith refine ⟨?_, ?_, hup⟩ · have h := (inv_le_inv₀ (by positivity : 0 < 2 / b) hpos).mpr hup simpa using h · have h := (inv_le_inv₀ hpos hi).mpr hlo simpa using h -
mesh_count_pow_letheorem — A bandwidth in (0,1] gives the dimension-dependent ceiling cell-count bound.hypothesesd :ℕb :ℝhb :0 < bhb1 :b ≤ 1conclusion(meshCount b : ℝ) ^ d ≤ (2 : ℝ) ^ d / b ^ dProof (Lean source)
theorem mesh_count_pow_le (d : ℕ) (b : ℝ) (hb : 0 < b) (hb1 : b ≤ 1) : (meshCount b : ℝ) ^ d ≤ (2 : ℝ) ^ d / b ^ d := by have h := pow_le_pow_left₀ (by positivity : 0 ≤ (meshCount b : ℝ)) (mesh_bounds b hb hb1).2.2 d simpa only [div_pow] using h -
optimizedBandwidth_memtheorem — Positive smoothness and at least one observation imply the optimized bandwidth is in (0,1].hypothesesd :ℕβ :ℝm :ℕhβ :0 < βhm :1 ≤ mProof (Lean source)
theorem optimizedBandwidth_mem (d : ℕ) (β : ℝ) (m : ℕ) (hβ : 0 < β) (hm : 1 ≤ m) : 0 < optimizedBandwidth d β m ∧ optimizedBandwidth d β m ≤ 1 := by have hm1 : (1 : ℝ) ≤ m := by exact_mod_cast hm have hmpos : 0 < (m : ℝ) := lt_of_lt_of_le zero_lt_one hm1 have hden : 0 < 2 * β + (d : ℝ) := by positivity unfold optimizedBandwidth exact ⟨Real.rpow_pos_of_pos hmpos _, Real.rpow_le_one_of_one_le_of_nonpos hm1 (neg_nonpos.mpr (one_div_pos.mpr hden).le)⟩ -
optimized_power_identitiestheorem — Positive smoothness and sample size give the exact balanced bias and reciprocal effective-sample-size powers at the optimized bandwidth.hypothesesd :ℕβ :ℝm :ℕhβ :0 < βhm :1 ≤ mconclusionconclusion 1(optimizedBandwidth d β m) ^ (2 * β) = (m : ℝ) ^ (-(2 * β / (2 * β + d)))conclusion 21 / ((m : ℝ) * (optimizedBandwidth d β m) ^ d) = (m : ℝ) ^ (-(2 * β / (2 * β + d)))Proof (Lean source)
theorem optimized_power_identities (d : ℕ) (β : ℝ) (m : ℕ) (hβ : 0 < β) (hm : 1 ≤ m) : (optimizedBandwidth d β m) ^ (2 * β) = (m : ℝ) ^ (-(2 * β / (2 * β + d))) ∧ 1 / ((m : ℝ) * (optimizedBandwidth d β m) ^ d) = (m : ℝ) ^ (-(2 * β / (2 * β + d))) := by -- Prove using rpow_mul, rpow_natCast, rpow_add, and positivity of m -- and 2β+d. The second exponent is -1+d/(2β+d)=-2β/(2β+d). have hmpos : 0 < (m : ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hm) have hden : 2 * β + (d : ℝ) ≠ 0 := ne_of_gt (by positivity) unfold optimizedBandwidth constructor · rw [← Real.rpow_mul hmpos.le] congr 1 ring · have hprod : (m : ℝ) * (m : ℝ) ^ (-(1 / (2 * β + d)) * d) = (m : ℝ) ^ (1 + -(1 / (2 * β + d)) * d) := by rw [Real.rpow_add hmpos, Real.rpow_one] rw [← Real.rpow_natCast, ← Real.rpow_mul hmpos.le, hprod, one_div, ← Real.rpow_neg hmpos.le] congr 1 field_simp [hden] ring
Geometry 3 core · 4 supporting The covariate domain is the closed unit cube in Euclidean space, with the Euclidean (L², not sup) metric. ★ cube_holder_oscillation
Euclidean unit-cube partition geometry
The covariate domain is the closed unit cube in Euclidean space, with the
Euclidean (L², not sup) metric. Floors at interior grid points choose the cell
to their right, and the coordinate value one is assigned to the final cell by
clamping the index. This keeps exactly meshCount b ^ d labels, covers the
boundary, and gives diameter at most sqrt(d)*b for positive bandwidths at
most one. Arbitrary probability distributions on the cube are permitted.
The closed unit cube in dimension consists of Euclidean vectors with every coordinate in the unit interval.
Definition (Lean source)
The cubical cell label for a bandwidth and cube point floors each scaled coordinate and clamps the endpoint to the final bin.
Definition (Lean source)
A positive Hölder exponent and nonnegative constant, a Hölder regression function, a bandwidth in (0,1], and equal cell labels give the oscillation bound |g x − g y| ≤ C (√d)^β b^β for two cube points in the same cell.
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
measurable_cubeLabeltheorem — Cubical labels are measurable for every bandwidth.Proof (Lean source)
@[fun_prop] theorem measurable_cubeLabel (d : ℕ) (b : ℝ) : Measurable (cubeLabel (d := d) b) := by apply measurable_pi_iff.mpr intro i let clamp : ℕ → Fin (meshCount b) := fun k => ⟨min k (meshCount b - 1), by have hn := meshCount_pos b have hle := Nat.min_le_right k (meshCount b - 1) omega⟩ have hf : Measurable (fun x : Cube d => ⌊(meshCount b : ℝ) * x.val i⌋₊) := (measurable_const.mul ((measurable_pi_apply i).comp ((WithLp.measurable_ofLp 2 _).comp measurable_subtype_coe))).nat_floor exact (measurable_of_countable clamp).comp hf -
same_cell_coordinate_letheorem — Equal cubical labels imply coordinate distance at most the reciprocal number of bins, including the upper cube boundary.hypothesesconclusion|x.val i - y.val i| ≤ (meshCount b : ℝ)⁻¹Proof (Lean source)
theorem same_cell_coordinate_le {d : ℕ} (b : ℝ) (x y : Cube d) (hlabel : cubeLabel b x = cubeLabel b y) (i : Fin d) : |x.val i - y.val i| ≤ (meshCount b : ℝ)⁻¹ := by -- Prove separately for a final-bin index and an interior index. The final -- bin uses x_i≤1, whereas interior bins use the floor interval bounds. have hn := meshCount_pos b have hnR : 0 < (meshCount b : ℝ) := by exact_mod_cast hn have hinterval (z : Cube d) : ((min ⌊(meshCount b : ℝ) * z.val i⌋₊ (meshCount b - 1) : ℕ) : ℝ) ≤ (meshCount b : ℝ) * z.val i ∧ (meshCount b : ℝ) * z.val i ≤ ((min ⌊(meshCount b : ℝ) * z.val i⌋₊ (meshCount b - 1) : ℕ) : ℝ) + 1 := by constructor · exact (Nat.cast_le.mpr (Nat.min_le_left _ _)).trans (Nat.floor_le (mul_nonneg hnR.le (z.property i).1)) · by_cases hf : ⌊(meshCount b : ℝ) * z.val i⌋₊ ≤ meshCount b - 1 · rw [min_eq_left hf] exact (Nat.lt_floor_add_one _).le · rw [min_eq_right (by omega)] have hcast : ((meshCount b - 1 : ℕ) : ℝ) + 1 = (meshCount b : ℝ) := by exact_mod_cast (show meshCount b - 1 + 1 = meshCount b by omega) rw [hcast] exact mul_le_of_le_one_right hnR.le (z.property i).2 have heq : min ⌊(meshCount b : ℝ) * x.val i⌋₊ (meshCount b - 1) = min ⌊(meshCount b : ℝ) * y.val i⌋₊ (meshCount b - 1) := congrArg (fun f => (f i).val) hlabel obtain ⟨hxl, hxu⟩ := hinterval x obtain ⟨hyl, hyu⟩ := hinterval y rw [← heq] at hyl hyu apply (abs_le).mpr have hinv : (meshCount b : ℝ) * (meshCount b : ℝ)⁻¹ = 1 := mul_inv_cancel₀ hnR.ne' constructor <;> nlinarith -
same_cell_diameter_letheorem — A bandwidth in (0,1] and equal cubical labels imply Euclidean point distance at most square-root dimension times bandwidth.hypothesesconclusiondist x y ≤ sqrt (d : ℝ) * bProof (Lean source)
theorem same_cell_diameter_le {d : ℕ} (b : ℝ) (hb : 0 < b) (hb1 : b ≤ 1) (x y : Cube d) (hlabel : cubeLabel b x = cubeLabel b y) : dist x y ≤ sqrt (d : ℝ) * b := by -- Sum squared coordinate differences in EuclideanSpace.norm_eq, use -- same_cell_coordinate_le and mesh_bounds, then compare square roots. have hcoord (i : Fin d) : dist (x.val i) (y.val i) ≤ b := by rw [Real.dist_eq] exact (same_cell_coordinate_le b x y hlabel i).trans (mesh_bounds b hb hb1).2.1 have hsum : ∑ i : Fin d, dist (x.val i) (y.val i) ^ 2 ≤ (d : ℝ) * b ^ 2 := by calc _ ≤ ∑ _i : Fin d, b ^ 2 := Finset.sum_le_sum fun i _ => pow_le_pow_left₀ dist_nonneg (hcoord i) 2 _ = _ := by simp change dist x.val y.val ≤ _ rw [EuclideanSpace.dist_eq] calc _ ≤ sqrt ((d : ℝ) * b ^ 2) := Real.sqrt_le_sqrt hsum _ = _ := by rw [Real.sqrt_mul (Nat.cast_nonneg d), Real.sqrt_sq hb.le] -
cube_label_cardtheorem — Cubical labels have exactly the ceiling mesh count to the dimension.
PatternMoments 2 core · 7 supporting A fixed subset of sample indices defines a measurable rectangle: selected coordinates lie in a given cell, and other coordinates lie in its complement. ★ integral_centered_sum_sq_on_pattern
Membership-pattern product moments
A fixed subset of sample indices defines a measurable rectangle: selected coordinates lie in a given cell, and other coordinates lie in its complement. Mathlib's restricted product measure and coordinate-product integral formulas give the factorization directly. The diagonal and centered cross-coordinate moments are isolated before the squared-sum identity. This layer depends only on the estimator definitions, not on binomial counts or regression hypotheses.
The membership pattern event specifies exactly which positions of a sample are in the cell determined by the partition, covariates, and label, using the prescribed index set.
Measurable inputs and integrable first and second response moments, with zero cell residual mean, imply that the iid-sample integral, over the event that exactly the selected positions fall in the cell, of the squared sum of the selected centered responses equals the number of selected positions, times the integral of the squared centered response over the cell, times the cell mass to the power of that number minus one, times the complementary mass to the power of the number of unselected positions.
Formal statement
Proof (Lean source)
7 supporting declarations (lemmas, instances)
-
cellPattern_eq_pitheorem — The membership pattern is the rectangle with the cell in selected coordinates and its complement elsewhere.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕlabel :A → κX :Ω → Ak :κconclusioncellPattern label X k T= Set.univ.pi (fun r => if r ∈ T then cell label X k else (cell label X k)ᶜ)Proof (Lean source)
theorem cellPattern_eq_pi {m : ℕ} (label : A → κ) (X : Ω → A) (k : κ) (T : Finset (Fin m)) : cellPattern label X k T = Set.univ.pi (fun r => if r ∈ T then cell label X k else (cell label X k)ᶜ) := by ext z simp only [cellPattern, Set.mem_ofPred_eq, Set.mem_pi, Set.mem_univ, forall_true_left] constructor · intro hz r by_cases hr : r ∈ T · simpa [hr, cell] using (hz r).mpr hr · simpa [hr, cell] using (fun h => hr ((hz r).mp h)) · intro hz r by_cases hr : r ∈ T · simpa [hr, cell] using hz r · simpa [hr, cell] using hz r -
measurableSet_cellPatterntheorem — Measurable labels and covariates give a measurable membership pattern for any selected subset.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕlabel :A → κX :Ω → Ak :κhlabel :Measurable labelhX :conclusionMeasurableSet (cellPattern label X k T)Proof (Lean source)
theorem measurableSet_cellPattern {m : ℕ} (label : A → κ) (X : Ω → A) (k : κ) (T : Finset (Fin m)) (hlabel : Measurable label) (hX : Measurable X) : MeasurableSet (cellPattern label X k T) := by have hc : MeasurableSet (cell label X k) := (measurableSet_singleton k).preimage (hlabel.comp hX) rw [cellPattern_eq_pi] apply MeasurableSet.univ_pi intro r split_ifs <;> first | exact hc | exact hc.compl -
cellCount_on_patterntheorem — A sample in the specified membership pattern has cell count equal to the size of the selected index set.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕlabel :A → κX :Ω → Ak :κz :Fin m → Ωhz :z ∈ cellPattern label X k TconclusioncellCount label X k z = T.cardProof (Lean source)
theorem cellCount_on_pattern {m : ℕ} (label : A → κ) (X : Ω → A) (k : κ) (T : Finset (Fin m)) (z : Fin m → Ω) (hz : z ∈ cellPattern label X k T) : cellCount label X k z = T.card := by unfold cellCount congr 1 ext r simpa only [mem_filter, Finset.mem_univ, true_and] using hz r -
integrableOn_pattern_prodtheorem — Integrable coordinate factors have an integrable product on every membership pattern under the iid law.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕμ :label :A → κX :Ω → Ak :κf :Fin m → Ω → ℝhf :∀ r, Integrable (f r) μconclusionIntegrableOn (fun z : Fin m → Ω => ∏ r, f r (z r)) (cellPattern label X k T) (Measure.pi (fun _ : Fin m => μ))Proof (Lean source)
theorem integrableOn_pattern_prod {m : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (label : A → κ) (X : Ω → A) (k : κ) (T : Finset (Fin m)) (f : Fin m → Ω → ℝ) (hf : ∀ r, Integrable (f r) μ) : IntegrableOn (fun z : Fin m → Ω => ∏ r, f r (z r)) (cellPattern label X k T) (Measure.pi (fun _ : Fin m => μ)) := by exact (Integrable.fintype_prod hf).integrableOn -
integral_pattern_prodtheorem — The coordinate product on a fixed membership pattern has integral equal to the product of the corresponding cell or complement set integrals under the iid probability law.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕμ :label :A → κX :Ω → Ak :κf :Fin m → Ω → ℝconclusion(∫ z in cellPattern label X k T, (∏ r, f r (z r)) ∂Measure.pi (fun _ : Fin m => μ))= ∏ r, ∫ ω in (if r ∈ T then cell label X k else (cell label X k)ᶜ), f r ω ∂μProof (Lean source)
theorem integral_pattern_prod {m : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (label : A → κ) (X : Ω → A) (k : κ) (T : Finset (Fin m)) (f : Fin m → Ω → ℝ) : (∫ z in cellPattern label X k T, (∏ r, f r (z r)) ∂Measure.pi (fun _ : Fin m => μ)) = ∏ r, ∫ ω in (if r ∈ T then cell label X k else (cell label X k)ᶜ), f r ω ∂μ := by rw [cellPattern_eq_pi, Measure.restrict_pi_pi] exact integral_fintype_prod_eq_prod f -
integral_pattern_coordinate_sqtheorem — Measurable partition inputs and a selected coordinate give a pattern-restricted squared residual integral equal to its cell second moment times the masses of all other coordinates.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕμ :label :A → κX :Ω → AY :Ω → ℝc :ℝk :κhlabel :Measurable labelhX :i :Fin mhi :i ∈ Tconclusion(∫ z in cellPattern label X k T, (Y (z i) - c) ^ 2 ∂Measure.pi (fun _ : Fin m => μ))= (∫ ω in cell label X k, (Y ω - c) ^ 2 ∂μ) * cellMass μ label X k ^ (T.card - 1) * (1 - cellMass μ label X k) ^ (m - T.card)Proof (Lean source)
theorem integral_pattern_coordinate_sq {m : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (label : A → κ) (X : Ω → A) (Y : Ω → ℝ) (c : ℝ) (k : κ) (T : Finset (Fin m)) (hlabel : Measurable label) (hX : Measurable X) (i : Fin m) (hi : i ∈ T) : (∫ z in cellPattern label X k T, (Y (z i) - c) ^ 2 ∂Measure.pi (fun _ : Fin m => μ)) = (∫ ω in cell label X k, (Y ω - c) ^ 2 ∂μ) * cellMass μ label X k ^ (T.card - 1) * (1 - cellMass μ label X k) ^ (m - T.card) := by classical let f : Fin m → Ω → ℝ := fun r ω => if r = i then (Y ω - c) ^ 2 else 1 have hp (z : Fin m → Ω) : (∏ r, f r (z r)) = (Y (z i) - c) ^ 2 := by simp [f] rw [← integral_congr_ae (Filter.Eventually.of_forall hp)] rw [integral_pattern_prod] let g : Fin m → ℝ := fun r => ∫ ω in (if r ∈ T then cell label X k else (cell label X k)ᶜ), f r ω ∂μ change (∏ r, g r) = _ have hc : MeasurableSet (cell label X k) := (measurableSet_singleton k).preimage (hlabel.comp hX) have hcompl : μ.real (cell label X k)ᶜ = 1 - cellMass μ label X k := by simpa [cellMass, measureReal_def] using measureReal_compl (μ := μ) hc rw [← Finset.prod_mul_prod_compl T g, ← Finset.mul_prod_erase T g hi] have hgi : g i = ∫ ω in cell label X k, (Y ω - c) ^ 2 ∂μ := by simp [g, f, hi] have hT : (∏ r ∈ T.erase i, g r) = cellMass μ label X k ^ (T.card - 1) := by calc _ = ∏ _r ∈ T.erase i, cellMass μ label X k := by apply Finset.prod_congr rfl intro r hr rcases Finset.mem_erase.mp hr with ⟨hri, hrT⟩ simp [g, f, hri, hrT, cellMass, measureReal_def] _ = _ := by simp [Finset.card_erase_of_mem hi] have hTc : (∏ r ∈ Tᶜ, g r) = (1 - cellMass μ label X k) ^ (m - T.card) := by calc _ = ∏ _r ∈ Tᶜ, (1 - cellMass μ label X k) := by apply Finset.prod_congr rfl intro r hr have hrT : r ∉ T := Finset.mem_compl.mp hr have hri : r ≠ i := fun h => hrT (h ▸ hi) simp [g, f, hri, hrT, hcompl] _ = _ := by simp [Finset.card_compl] rw [hgi, hT, hTc] -
integral_pattern_cross_eq_zerotheorem — Two distinct coordinates, the first of them selected, with centered cell residuals have zero cross moment on the fixed pattern.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕμ :label :A → κX :Ω → AY :Ω → ℝc :ℝk :κi j :Fin mhi :i ∈ Thij :i ≠ jhcenter :(∫ ω in cell label X k, (Y ω - c) ∂μ) = 0conclusion(∫ z in cellPattern label X k T, (Y (z i) - c) * (Y (z j) - c) ∂Measure.pi (fun _ : Fin m => μ))= 0Proof (Lean source)
theorem integral_pattern_cross_eq_zero {m : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (label : A → κ) (X : Ω → A) (Y : Ω → ℝ) (c : ℝ) (k : κ) (T : Finset (Fin m)) (i j : Fin m) (hi : i ∈ T) (hij : i ≠ j) (hcenter : (∫ ω in cell label X k, (Y ω - c) ∂μ) = 0) : (∫ z in cellPattern label X k T, (Y (z i) - c) * (Y (z j) - c) ∂Measure.pi (fun _ : Fin m => μ)) = 0 := by classical let f : Fin m → Ω → ℝ := fun r ω => (if r = i then Y ω - c else 1) * (if r = j then Y ω - c else 1) have hp (z : Fin m → Ω) : (∏ r, f r (z r)) = (Y (z i) - c) * (Y (z j) - c) := by simp only [f, Finset.prod_mul_distrib] simp rw [← integral_congr_ae (Filter.Eventually.of_forall hp), integral_pattern_prod] apply Finset.prod_eq_zero (Finset.mem_univ i) simpa [f, hi, hij] using hcenter
PatternMeans 2 core · 1 supporting This layer turns the closed rectangle moments into a reciprocal-count identity on each membership pattern. ★ integral_centeredCellMean_sq_on_pattern
Totalized centered means on membership patterns
This layer turns the closed rectangle moments into a reciprocal-count identity
on each membership pattern. It also isolates square integrability of the
zero-totalized empirical mean, including sample size zero. The global variance
formula in Centered can then sum over patterns and invoke the count law,
without another combinatorial grouping by cardinality.
The zero-totalized empirical centered cell mean divides the cell sum of responses centered at the specified value by the cell count for the given partition, covariates, label, and sample, and equals zero when the sample has no observation in the cell.
Measurable inputs and integrable response moments, zero cell residual mean, and positive cell mass give a patternwise squared centered-mean integral equal to the within-cell second moment times the patternwise totalized reciprocal-count integral.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
integrable_centeredCellMean_sqtheorem — Measurable partition inputs and responses with integrable first and second response moments give an integrable squared totalized centered cell mean under iid sampling.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕμ :label :A → κX :Ω → AY :Ω → ℝc :ℝk :κhlabel :Measurable labelhX :hY :hint :Integrable Y μhsq :Integrable (fun ω => Y ω ^ 2) μconclusionIntegrable (fun z : Fin m → Ω => (centeredCellMean label X Y c k z) ^ 2) (Measure.pi (fun _ : Fin m => μ))Proof (Lean source)
theorem integrable_centeredCellMean_sq {m : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (label : A → κ) (X : Ω → A) (Y : Ω → ℝ) (c : ℝ) (k : κ) (hlabel : Measurable label) (hX : Measurable X) (hY : Measurable Y) (hint : Integrable Y μ) (hsq : Integrable (fun ω => Y ω ^ 2) μ) : Integrable (fun z : Fin m → Ω => (centeredCellMean label X Y c k z) ^ 2) (Measure.pi (fun _ : Fin m => μ)) := by -- First derive integrability of (Y-c)^2 from the two response moments. -- Measurability follows by finite sums, measurable_cellCount, and division. -- At count zero the quotient is zero. Otherwise its squared value is bounded -- by m times the sum of coordinate residual squares (finite Cauchy-Schwarz -- and count >= 1). Each coordinate square is integrable_comp_eval. classical have hres2 : Integrable (fun ω => (Y ω - c) ^ 2) μ := by have h := (hsq.sub (hint.const_mul (2 * c))).add (integrable_const (c ^ 2)) refine h.congr (Filter.Eventually.of_forall ?_) intro ω change Y ω ^ 2 - (2 * c) * Y ω + c ^ 2 = (Y ω - c) ^ 2 ring have hsum : Measurable (cellSum (m := m) label X (fun ω => Y ω - c) k) := by unfold cellSum apply Finset.measurable_fun_sum intro r _ exact Measurable.ite ((measurableSet_singleton k).preimage (hlabel.comp (hX.comp (measurable_pi_apply r)))) ((hY.comp (measurable_pi_apply r)).sub measurable_const) measurable_const have hcast : Measurable (fun z : Fin m → Ω => (cellCount label X k z : ℝ)) := (measurable_of_countable (fun n : ℕ => (n : ℝ))).comp (measurable_cellCount label X k hlabel hX) have hmeas : Measurable (fun z : Fin m → Ω => (centeredCellMean label X Y c k z) ^ 2) := (hsum.div hcast).pow_const 2 have hdom : Integrable (fun z : Fin m → Ω => (m : ℝ) * ∑ r : Fin m, (Y (z r) - c) ^ 2) (Measure.pi (fun _ : Fin m => μ)) := (integrable_finsetSum univ (fun r _ => integrable_comp_eval (μ := fun _ : Fin m => μ) (i := r) hres2)).const_mul _ refine hdom.mono' hmeas.aestronglyMeasurable (Filter.Eventually.of_forall ?_) intro z rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] have hnonneg : 0 ≤ (m : ℝ) * ∑ r : Fin m, (Y (z r) - c) ^ 2 := mul_nonneg (Nat.cast_nonneg _) (Finset.sum_nonneg (fun r _ => sq_nonneg _)) by_cases hn : cellCount label X k z = 0 · simpa [centeredCellMean, hn] using hnonneg · have hn1 : (1 : ℝ) ≤ (cellCount label X k z : ℝ) := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr hn have hn2 : (1 : ℝ) ≤ (cellCount label X k z : ℝ) ^ 2 := by nlinarith have hcs := Finset.sum_mul_sq_le_sq_mul_sq univ (fun _ : Fin m => (1 : ℝ)) (fun r => if label (X (z r)) = k then Y (z r) - c else 0) have hcs' : (cellSum label X (fun ω => Y ω - c) k z) ^ 2 ≤ (m : ℝ) * ∑ r : Fin m, (Y (z r) - c) ^ 2 := by have hcs0 : (cellSum label X (fun ω => Y ω - c) k z) ^ 2 ≤ (m : ℝ) * ∑ r : Fin m, (if label (X (z r)) = k then Y (z r) - c else 0) ^ 2 := by simpa [cellSum] using hcs refine hcs0.trans ?_ apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg m) apply Finset.sum_le_sum intro r _ split_ifs <;> simp [sq_nonneg] simpa only [centeredCellMean, div_pow] using (div_le_self (sq_nonneg (cellSum label X (fun ω => Y ω - c) k z)) hn2).trans hcs'
CellVariance 1 core · 1 supporting Condition on the full subset of observations falling in one cell. ★ nonempty_cell_mse_le
Global centered cell-sample variance
Condition on the full subset of observations falling in one cell. Centering
annuls cross terms, leaving the cell variance times the reciprocal count.
The finite-pattern moments are isolated in PatternMoments, and their
totalized-mean consequences in PatternMeans, independently of the binomial
identity in Counts;
the bounded-response consequence controls the nonempty centered mean.
Clipping and the arbitrary empty default are handled separately in Centered.
Related infrastructure, without an import dependency on it, is in
Causalean.Stat.Sample.Stratified.CenteredNoiseBound and
Causalean.Stat.Sample.OccupancyWeightedMean.MomentBounds.
A measurable partition and responses, unit-interval responses, and positive cell mass imply that the cell mass times the iid-sample expectation of the squared empirical cell mean centered at the population cell mean (taken as zero on an empty cell) is at most two over the sample size plus one.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
integral_centeredCellMean_sq_eqtheorem — Measurable inputs and integrable response moments, zero cell residual mean, and positive cell mass give the exact reciprocal-binomial-count variance formula.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕμ :label :A → κX :Ω → AY :Ω → ℝc :ℝk :κhlabel :Measurable labelhX :hY :hint :Integrable Y μhsq :Integrable (fun ω => Y ω ^ 2) μhcenter :(∫ ω in cell label X k, (Y ω - c) ∂μ) = 0hp :0 < cellMass μ label X kconclusion= ((∫ ω in cell label X k, (Y ω - c) ^ 2 ∂μ) / cellMass μ label X k) * ∑ j ∈ range (m + 1), binomialWeight m (cellMass μ label X k) j * (if 0 < j then (j : ℝ)⁻¹ else 0)Proof (Lean source)
theorem integral_centeredCellMean_sq_eq {m : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (label : A → κ) (X : Ω → A) (Y : Ω → ℝ) (c : ℝ) (k : κ) (hlabel : Measurable label) (hX : Measurable X) (hY : Measurable Y) (hint : Integrable Y μ) (hsq : Integrable (fun ω => Y ω ^ 2) μ) (hcenter : (∫ ω in cell label X k, (Y ω - c) ∂μ) = 0) (hp : 0 < cellMass μ label X k) : (∫ z : Fin m → Ω, (centeredCellMean label X Y c k z) ^ 2 ∂Measure.pi (fun _ : Fin m => μ)) = ((∫ ω in cell label X k, (Y ω - c) ^ 2 ∂μ) / cellMass μ label X k) * ∑ j ∈ range (m + 1), binomialWeight m (cellMass μ label X k) j * (if 0 < j then (j : ℝ)⁻¹ else 0) := by -- Use integrable_centeredCellMean_sq and split both integrals over all -- membership patterns T : Finset (Fin m), a measurable disjoint cover. -- Sum integral_centeredCellMean_sq_on_pattern. The bounded inverse-count -- integrand is integrable; apply integral_cellCount_eq_binomial to it. -- This route avoids summing powersetCard/binomial coefficients a second time. classical let ν := Measure.pi (fun _ : Fin m => μ) let R : (Fin m → Ω) → ℝ := fun z => if 0 < cellCount label X k z then (cellCount label X k z : ℝ)⁻¹ else 0 have hRmeas : Measurable R := (measurable_of_countable (fun j : ℕ => if 0 < j then (j : ℝ)⁻¹ else 0)).comp (measurable_cellCount label X k hlabel hX) have hR : Integrable R ν := by refine (integrable_const (1 : ℝ)).mono' hRmeas.aestronglyMeasurable (Filter.Eventually.of_forall ?_) intro z dsimp [R] split_ifs with hn · rw [abs_of_nonneg (inv_nonneg.mpr (Nat.cast_nonneg _))] apply inv_le_one_of_one_le₀ exact_mod_cast hn · simp have hmeas := fun T : Finset (Fin m) => measurableSet_cellPattern label X k T hlabel hX have hdisj : Pairwise (onFun Disjoint (fun T : Finset (Fin m) => cellPattern label X k T)) := by intro T U hTU apply Set.disjoint_left.mpr intro z hzT hzU apply hTU ext r exact (hzT r).symm.trans (hzU r) have hcover : (⋃ T : Finset (Fin m), cellPattern label X k T) = univ := by apply Set.eq_univ_of_forall intro z apply Set.mem_iUnion.mpr refine ⟨Finset.univ.filter (fun r => label (X (z r)) = k), ?_⟩ intro r simp have hmean := integrable_centeredCellMean_sq (m := m) μ label X Y c k hlabel hX hY hint hsq have hsum := integral_iUnion_fintype hmeas hdisj (fun T => hmean.integrableOn (s := cellPattern label X k T)) have hsumR := integral_iUnion_fintype hmeas hdisj (fun T => hR.integrableOn (s := cellPattern label X k T)) rw [hcover, setIntegral_univ] at hsum hsumR rw [hsum] simp_rw [integral_centeredCellMean_sq_on_pattern μ label X Y c k _ hlabel hX hint hsq hcenter hp] rw [← Finset.mul_sum, ← hsumR] rw [integral_cellCount_eq_binomial μ label X k (fun j => if 0 < j then (j : ℝ)⁻¹ else 0) hlabel hX]
Centered 1 core · 0 supporting Combine the closed-form centered-mean variance and empty-cell probability with the deterministic clipping comparison. ★ cell_estimation_mse_le
Totalized clipped cell-estimation risk
Combine the closed-form centered-mean variance and empty-cell probability with the deterministic clipping comparison. The fixed default may be any point in the unit interval. No lower cell-mass bound is required.
Measurable inputs, unit-interval responses and default, and positive cell mass imply mass-weighted cell-estimation MSE at most three over the sample-size successor.
Formal statement
Proof (Lean source)
Counts 1 core · 3 supporting This layer transfers iid product sampling to the real binomial weights already provided by Causalean. ★ mass_mul_integral_inverse_count_le
Binomial cell counts and empty-cell control
This layer transfers iid product sampling to the real binomial weights already provided by Causalean. The empty-cell inequality includes both endpoints of the probability interval and sample size zero. No regression or risk assumption is used here.
A measurable partition and positive cell mass give mass-weighted expected reciprocal count at most twice the reciprocal sample-size successor.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
integral_cellCount_eq_binomialtheorem — A measurable covariate partition implies that expectations of functions of a cell count equal the corresponding binomial sum.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕμ :label :A → κX :Ω → Ak :κF :ℕ → ℝhlabel :Measurable labelhX :conclusion= ∑ j ∈ range (m + 1), binomialWeight m (cellMass μ label X k) j * F jProof (Lean source)
theorem integral_cellCount_eq_binomial {m : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (label : A → κ) (X : Ω → A) (k : κ) (F : ℕ → ℝ) (hlabel : Measurable label) (hX : Measurable X) : (∫ z : Fin m → Ω, F (cellCount label X k z) ∂Measure.pi (fun _ : Fin m => μ)) = ∑ j ∈ range (m + 1), binomialWeight m (cellMass μ label X k) j * F j := by -- Push the sample through its Bool membership design, integrate the finite -- design law, and reuse sum_bernoulli_eq_binomial. Arbitrary F is harmless: -- the count has finite range, so its composition is integrable. classical let B : Ω → Bool := fun ω => if label (X ω) = k then true else false have hs : MeasurableSet (cell label X k) := (measurableSet_singleton k).preimage (hlabel.comp hX) have hB : Measurable B := Measurable.ite hs measurable_const measurable_const have hp0 : 0 ≤ cellMass μ label X k := ENNReal.toReal_nonneg have hp1 : cellMass μ label X k ≤ 1 := by exact measureReal_le_one have hmap : μ.map B = bernoulliBool (cellMass μ label X k) := by apply Measure.ext_of_singleton intro b rw [Measure.map_apply hB (measurableSet_singleton b)] cases b · have he : B ⁻¹' {false} = (cell label X k)ᶜ := by ext ω simp [B, cell] rw [he, measure_compl hs (measure_ne_top μ _)] simp [bernoulliBool, cellMass, ENNReal.ofReal_sub, ENNReal.ofReal_toReal (measure_ne_top μ _)] · have he : B ⁻¹' {true} = cell label X k := by ext ω simp [B, cell] rw [he] simp [bernoulliBool, cellMass, ENNReal.ofReal_toReal (measure_ne_top μ _)] let T : (Fin m → Ω) → (Fin m → Bool) := fun z r => B (z r) have hT : Measurable T := measurable_pi_lambda _ fun r => hB.comp (measurable_pi_apply r) have hpi : (Measure.pi (fun _ : Fin m => μ)).map T = Measure.pi (fun _ : Fin m => bernoulliBool (cellMass μ label X k)) := by rw [Measure.pi_map_pi (fun _ => hB.aemeasurable)] simp only [hmap] have : IsProbabilityMeasure (bernoulliBool (cellMass μ label X k)) := Causalean.Mathlib.Probability.bernoulliBool_isProbabilityMeasure hp0 hp1 let G : (Fin m → Bool) → ℝ := fun b => F (Finset.univ.filter fun r => b r = true).card have hcount (z : Fin m → Ω) : G (T z) = F (cellCount label X k z) := by simp [G, T, B, cellCount] rw [← show (fun z => G (T z)) = (fun z => F (cellCount label X k z)) from funext hcount, ← integral_map hT.aemeasurable (measurable_of_finite G).aestronglyMeasurable, hpi, integral_fintype Integrable.of_finite] calc _ = ∑ b : Fin m → Bool, (∏ r, if b r then cellMass μ label X k else 1 - cellMass μ label X k) * F (Finset.univ.filter fun r => b r = true).card := by apply Finset.sum_congr rfl intro b _ rw [measureReal_def, Measure.pi_singleton, ENNReal.toReal_prod] simp only [smul_eq_mul, G] congr 1 apply Finset.prod_congr rfl intro r _ cases b r <;> simp [bernoulliBool, hp0, sub_nonneg.mpr hp1] _ = _ := by simpa using sum_bernoulli_eq_binomial (ι := Fin m) (cellMass μ label X k) F -
empty_cell_probabilitytheorem — A measurable covariate partition gives empty-cell probability equal to the failure probability raised to the sample size.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕμ :label :A → κX :Ω → Ak :κhlabel :Measurable labelhX :Proof (Lean source)
theorem empty_cell_probability {m : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (label : A → κ) (X : Ω → A) (k : κ) (hlabel : Measurable label) (hX : Measurable X) : ((Measure.pi (fun _ : Fin m => μ)) {z | cellCount label X k z = 0}).toReal = (1 - cellMass μ label X k) ^ m := by classical have hs : MeasurableSet {z : Fin m → Ω | cellCount label X k z = 0} := (measurableSet_singleton 0).preimage (measurable_cellCount label X k hlabel hX) have h := integral_cellCount_eq_binomial (m := m) μ label X k (fun j => if j = 0 then 1 else 0) hlabel hX have hi : (∫ z : Fin m → Ω, (if cellCount label X k z = 0 then (1 : ℝ) else 0) ∂Measure.pi (fun _ : Fin m => μ)) = ((Measure.pi (fun _ : Fin m => μ)) {z | cellCount label X k z = 0}).toReal := by simpa only [indicator, Set.mem_ofPred_eq, Pi.one_apply, measureReal_def] using (integral_indicator_one (μ := Measure.pi (fun _ : Fin m => μ)) hs) rw [hi] at h simpa [binomialWeight] using h -
mass_mul_empty_probability_letheorem — A probability in the unit interval satisfies the mass-weighted empty-cell bound, including zero observations.Proof (Lean source)
theorem mass_mul_empty_probability_le (m : ℕ) (p : ℝ) (hp : p ∈ Icc (0 : ℝ) 1) : p * (1 - p) ^ m ≤ 1 / (m + 1 : ℝ) := by -- The first m+1 terms of the geometric series are each at least (1-p)^m; -- multiply by p and use the telescoping sum 1-(1-p)^(m+1) ≤ 1. have hq0 : 0 ≤ 1 - p := sub_nonneg.mpr hp.2 have hq1 : 1 - p ≤ 1 := by linarith [hp.1] have hsum : (m + 1 : ℝ) * (1 - p) ^ m ≤ ∑ j ∈ range (m + 1), (1 - p) ^ j := by calc _ = ∑ j ∈ range (m + 1), (1 - p) ^ m := by simp _ ≤ _ := by apply Finset.sum_le_sum intro j hj exact pow_le_pow_of_le_one hq0 hq1 (by simpa using Finset.mem_range.mp hj) have hid := geom_sum_mul_neg (1 - p) (m + 1) have hbound : p * ((m + 1 : ℝ) * (1 - p) ^ m) ≤ 1 := by have hmul := mul_le_mul_of_nonneg_left hsum hp.1 have hpow := pow_nonneg hq0 (m + 1) simp only [sub_sub_cancel] at hid nlinarith apply (le_div_iff₀ (by positivity : (0 : ℝ) < m + 1)).2 nlinarith
CubicalRisk 1 core · 2 supporting For any observation law with unit-cube covariates and bounded responses whose conditional mean is Hölder, the ceiling-mesh histogram has squared bias of order b^(2β) and variance of order 1/(m*b^d). ★ optimized_cubical_histogram_risk_le
Hölder cubical histogram risk and optimized rate
For any observation law with unit-cube covariates and bounded responses whose
conditional mean is Hölder, the ceiling-mesh histogram has squared bias of
order b^(2β) and variance of order 1/(m*b^d). The optimized bandwidth gives
the explicit rate m^(-2β/(2β+d)). Constants depend only on dimension and the
Hölder constant/exponent, and all cube boundary points and empty cells are kept.
The integrated marginal loss and zero-empty-cell convention are classical: Andrew Nobel, "Histogram Regression Estimation Using Data-dependent Partitions" (1995), introduction and equation (2), https://nobel.web.unc.edu/wp-content/uploads/sites/13591/2017/01/histreg.pdf. Here the default is generalized to any fixed point of the unit interval; the finite-sample rate is derived from the closed occupancy and mesh lemmas.
Measurable regression inputs, bounded responses and default, the conditional mean identity, positive Hölder smoothness and nonnegative constant, a Hölder bound, and at least one observation give the bound (2 C² (√d)^(2β) + 6 · 2^d) · m^(-2β/(2β+d)) on the expected integrated squared risk, under iid sampling, of the cubical histogram with the optimized bandwidth m^(-1/(2β+d)).
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
cubical_histogram_risk_letheorem — Measurable cube covariates, responses, and regression function, bounded responses and default, the conditional mean identity, positive smoothness and a nonnegative Hölder constant, a Hölder bound, and a bandwidth in (0,1] imply the explicit bias-plus-cell-count histogram risk bound.hypothesesΩ :sharedType u_1d m :ℕμ :X :Ω → Cube dY :Ω → ℝg :Cube d → ℝa β C b :ℝhX :hY :hg :hbound :∀ᵐ ω ∂μ, Y ω ∈ Icc (0 : ℝ) 1ha :a ∈ Icc (0 : ℝ) 1hmean :ConditionalMean μ X Y ghβ :0 < βhC :0 ≤ Chb :0 < bhb1 :b ≤ 1hholder :∀ x y, |g x - g y| ≤ C * (dist x y) ^ βProof (Lean source)
theorem cubical_histogram_risk_le {d m : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → Cube d) (Y : Ω → ℝ) (g : Cube d → ℝ) (a β C b : ℝ) (hX : Measurable X) (hY : Measurable Y) (hg : Measurable g) (hbound : ∀ᵐ ω ∂μ, Y ω ∈ Icc (0 : ℝ) 1) (ha : a ∈ Icc (0 : ℝ) 1) (hmean : ConditionalMean μ X Y g) (hβ : 0 < β) (hC : 0 ≤ C) (hb : 0 < b) (hb1 : b ≤ 1) (hholder : ∀ x y, |g x - g y| ≤ C * (dist x y) ^ β) : risk μ (Measure.pi (fun _ : Fin m => μ)) (cubeLabel b) X Y a g ≤ 2 * C ^ 2 * (sqrt (d : ℝ)) ^ (2 * β) * b ^ (2 * β) + 6 * (meshCount b : ℝ) ^ d / (m + 1 : ℝ) := by -- The constant oscillation envelope sums against cell masses totaling one. -- Count only positive-mass cells before comparing with the full label type. -- Nonnegative-base rpow identities retain the zero-dimensional cube case. let D : ℝ := C * (sqrt (d : ℝ)) ^ β * b ^ β have hD : 0 ≤ D := by dsimp [D]; positivity have hosc : ∀ k x y, cubeLabel b x = k → cubeLabel b y = k → |g x - g y| ≤ D := by intro k x y hx hy exact cube_holder_oscillation g β C b hβ hC hb hb1 hholder x y (hx.trans hy.symm) have hr := histogram_risk_le (m := m) μ (cubeLabel b) X Y g a (fun _ => D) (measurable_cubeLabel d b) hX hY hg hbound ha hmean (fun _ => hD) hosc have hmass := sum_positiveCells_mass μ (cubeLabel b) X (measurable_cubeLabel d b) hX have hsum : (∑ k ∈ positiveCells μ (cubeLabel b) X, cellMass μ (cubeLabel b) X k * D ^ 2) = D ^ 2 := by rw [← Finset.sum_mul, hmass, one_mul] have hcard : ((positiveCells μ (cubeLabel b) X).card : ℝ) ≤ (meshCount b : ℝ) ^ d := by have hn := Finset.card_le_univ (positiveCells μ (cubeLabel b) X) rw [cube_label_card d b] at hn exact_mod_cast hn have hsqrt : ((sqrt (d : ℝ)) ^ β) ^ (2 : ℕ) = (sqrt (d : ℝ)) ^ (2 * β) := by rw [← Real.rpow_two, ← Real.rpow_mul (Real.sqrt_nonneg _)] congr 1 ring have hbpow : (b ^ β) ^ (2 : ℕ) = b ^ (2 * β) := by rw [← Real.rpow_two, ← Real.rpow_mul hb.le] congr 1 ring have hDsquare : D ^ 2 = C ^ 2 * (sqrt (d : ℝ)) ^ (2 * β) * b ^ (2 * β) := by dsimp [D] rw [mul_pow, mul_pow, hsqrt, hbpow] rw [hsum, hDsquare] at hr calc _ ≤ 2 * (C ^ 2 * (sqrt (d : ℝ)) ^ (2 * β) * b ^ (2 * β)) + 6 * ((positiveCells μ (cubeLabel b) X).card : ℝ) / (m + 1 : ℝ) := hr _ ≤ 2 * (C ^ 2 * (sqrt (d : ℝ)) ^ (2 * β) * b ^ (2 * β)) + 6 * (meshCount b : ℝ) ^ d / (m + 1 : ℝ) := by apply add_le_add le_rfl exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hcard (by norm_num)) (by positivity) _ = _ := by ring -
cubical_histogram_bandwidth_risk_letheorem — Measurable regression inputs, bounded responses and default, the conditional mean identity, positive Hölder smoothness and a nonnegative constant, a Hölder bound, a bandwidth in (0,1], and at least one observation imply the bias-plus-inverse-effective-sample-size risk bound.hypothesesΩ :sharedType u_1d m :ℕμ :X :Ω → Cube dY :Ω → ℝg :Cube d → ℝa β C b :ℝhX :hY :hg :hbound :∀ᵐ ω ∂μ, Y ω ∈ Icc (0 : ℝ) 1ha :a ∈ Icc (0 : ℝ) 1hmean :ConditionalMean μ X Y ghβ :0 < βhC :0 ≤ Chb :0 < bhb1 :b ≤ 1hm :1 ≤ mhholder :∀ x y, |g x - g y| ≤ C * (dist x y) ^ βProof (Lean source)
theorem cubical_histogram_bandwidth_risk_le {d m : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → Cube d) (Y : Ω → ℝ) (g : Cube d → ℝ) (a β C b : ℝ) (hX : Measurable X) (hY : Measurable Y) (hg : Measurable g) (hbound : ∀ᵐ ω ∂μ, Y ω ∈ Icc (0 : ℝ) 1) (ha : a ∈ Icc (0 : ℝ) 1) (hmean : ConditionalMean μ X Y g) (hβ : 0 < β) (hC : 0 ≤ C) (hb : 0 < b) (hb1 : b ≤ 1) (hm : 1 ≤ m) (hholder : ∀ x y, |g x - g y| ≤ C * (dist x y) ^ β) : risk μ (Measure.pi (fun _ : Fin m => μ)) (cubeLabel b) X Y a g ≤ 2 * C ^ 2 * (sqrt (d : ℝ)) ^ (2 * β) * b ^ (2 * β) + (6 * (2 : ℝ) ^ d) / ((m : ℝ) * b ^ d) := by -- First bound the ceiling cell count by (2/b)^d; then replace m+1 by m. have hmpos : 0 < (m : ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hm) refine (cubical_histogram_risk_le μ X Y g a β C b hX hY hg hbound ha hmean hβ hC hb hb1 hholder).trans ?_ apply add_le_add le_rfl calc 6 * (meshCount b : ℝ) ^ d / (m + 1 : ℝ) ≤ 6 * ((2 : ℝ) ^ d / b ^ d) / (m + 1 : ℝ) := div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (mesh_count_pow_le d b hb hb1) (by norm_num)) (by positivity) _ ≤ 6 * ((2 : ℝ) ^ d / b ^ d) / (m : ℝ) := div_le_div_of_nonneg_left (by positivity) hmpos (by linarith) _ = _ := by ring
EstimatorComparison 1 core · 1 supporting Clipping an empirical mean to the unit interval contracts squared distance to every unit-interval center. ★ cellEstimate_sq_error_le
Clipping and empty-default comparisons
Clipping an empirical mean to the unit interval contracts squared distance to every unit-interval center. An empty cell contributes at most one when the default lies in the same interval. These deterministic comparisons do not assume bounded responses; they separate estimator algebra from the iid variance analysis. The clipped squared error is integrable under every iid probability law with measurable inputs.
A unit-interval default and center give a pointwise bound on squared cell-estimation error by the squared totalized centered empirical mean plus the empty-cell indicator.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
integrable_cellEstimate_sq_errortheorem — Measurable partition inputs and responses and a unit-interval default and center imply the clipped cell-estimation squared error is integrable under iid sampling.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕμ :label :A → κX :Ω → AY :Ω → ℝa c :ℝk :κhlabel :Measurable labelhX :hY :ha :a ∈ Icc (0 : ℝ) 1hc :c ∈ Icc (0 : ℝ) 1conclusionIntegrable (fun z : Fin m → Ω => (cellEstimate label X Y a k z - c) ^ 2) (Measure.pi (fun _ : Fin m => μ))Proof (Lean source)
theorem integrable_cellEstimate_sq_error {m : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (label : A → κ) (X : Ω → A) (Y : Ω → ℝ) (a c : ℝ) (k : κ) (hlabel : Measurable label) (hX : Measurable X) (hY : Measurable Y) (ha : a ∈ Icc (0 : ℝ) 1) (hc : c ∈ Icc (0 : ℝ) 1) : Integrable (fun z : Fin m → Ω => (cellEstimate label X Y a k z - c) ^ 2) (Measure.pi (fun _ : Fin m => μ)) := by -- Measurability follows from measurable_cellEstimate, subtraction, and square. -- Every estimate is in [0,1] by the definition of clip and ha; no hbound -- or tuple-ae argument is needed. Dominate the loss by the constant 1 -- using Integrable.mono' and sq_le_sq' with bounds -1≤estimate-c≤1. have hmeas : Measurable (fun z : Fin m → Ω => (cellEstimate label X Y a k z - c) ^ 2) := ((measurable_cellEstimate label X Y a k hlabel hX hY).sub measurable_const).pow_const 2 refine (integrable_const (1 : ℝ)).mono' hmeas.aestronglyMeasurable (Filter.Eventually.of_forall ?_) intro z have he : cellEstimate label X Y a k z ∈ Icc (0 : ℝ) 1 := by unfold cellEstimate split_ifs · exact ha · exact ⟨le_max_left _ _, max_le (by norm_num) (min_le_left _ _)⟩ rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] simpa using (sq_le_sq' (by linarith [he.1, hc.2]) (by linarith [he.2, hc.1]) : (cellEstimate label X Y a k z - c) ^ 2 ≤ (1 : ℝ) ^ 2)
IIDTransfer 1 core · 1 supporting The integrated squared histogram loss is a measurable function of the training tuple. ★ integral_histogram_loss_eq_risk_iid
Transferring histogram loss along an iid sample law
The integrated squared histogram loss is a measurable function of the training
tuple. Independent observations with a common law therefore have exactly the
same expected integrated loss as canonical product samples. This layer does
not require bounded responses or a conditional mean, and is independent of
the statistical risk inequality in Risk.
Measurable iid observation maps with a common law and measurable partition inputs, responses, and target give equality of expected integrated squared histogram loss on the original sample space and the canonical product sample space.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
measurable_integrated_sq_losstheorem — Measurable partition inputs, responses, and target give measurable integrated squared histogram loss as a function of the training tuple under a probability observation law.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕμ :label :A → κX :Ω → AY :Ω → ℝg :A → ℝa :ℝhlabel :Measurable labelhX :hY :hg :conclusionProof (Lean source)
theorem measurable_integrated_sq_loss {m : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (label : A → κ) (X : Ω → A) (Y : Ω → ℝ) (g : A → ℝ) (a : ℝ) (hlabel : Measurable label) (hX : Measurable X) (hY : Measurable Y) (hg : Measurable g) : Measurable (fun z : Fin m → Ω => ∫ ω, (histogram label X Y a z (X ω) - g (X ω)) ^ 2 ∂μ) := by -- Compose measurable_histogram with (z,ω) ↦ (z,X ω), subtract g∘X, -- and square. For real-valued functions, joint measurability supplies -- StronglyMeasurable; StronglyMeasurable.integral_prod_right then gives -- the claim. Bochner totalization allows nonintegrable sections, so no -- boundedness or integrability premise is needed for this measurability. have hpred : Measurable (fun q : (Fin m → Ω) × Ω => histogram label X Y a q.1 (X q.2)) := (measurable_histogram label X Y a hlabel hX hY).comp (measurable_fst.prodMk (hX.comp measurable_snd)) have hloss : Measurable (fun q : (Fin m → Ω) × Ω => (histogram label X Y a q.1 (X q.2) - g (X q.2)) ^ 2) := (hpred.sub (hg.comp (hX.comp measurable_snd))).pow_const 2 exact hloss.stronglyMeasurable.integral_prod_right.measurable
PartitionTotals 1 core · 1 supporting These label-API bridges reuse Mathlib's finite disjoint-union integral theorem, then remove zero-mass fibers. ★ integral_eq_sum_positive_cells
Integration over the positive-mass partition
These label-API bridges reuse Mathlib's finite disjoint-union integral theorem, then remove zero-mass fibers. They supply the partition sum for integrated risk and the mass-one simplification for a constant cubical oscillation envelope. Zero-mass cells are retained in the estimator and omitted only from integrals.
A measurable finite partition and covariates and an integrable observation function give its integral as the sum of set integrals over positive-mass cells.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
sum_positiveCells_masstheorem — Measurable finite partition labels and covariates imply the real masses of the positive-mass cells sum to one.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3μ :label :A → κX :Ω → Ahlabel :Measurable labelhX :conclusion(∑ k ∈ positiveCells μ label X, cellMass μ label X k) = 1Proof (Lean source)
theorem sum_positiveCells_mass (μ : Measure Ω) [IsProbabilityMeasure μ] (label : A → κ) (X : Ω → A) (hlabel : Measurable label) (hX : Measurable X) : (∑ k ∈ positiveCells μ label X, cellMass μ label X k) = 1 := by -- Apply integral_eq_sum_positive_cells to the constant function 1 and -- simplify setIntegral_const, cellMass, and measure_univ. This reuses the -- finite integral partition law rather than reproving a measure sum law. have h := integral_eq_sum_positive_cells μ label X (fun _ => (1 : ℝ)) hlabel hX (integrable_const 1) simpa [cellMass, setIntegral_const, Measure.real] using h.symm
Risk 1 core · 1 supporting The universal bound is twice the mass-weighted squared oscillation plus six times the number of positive-mass cells divided by m+1. ★ histogram_risk_le
Integrated finite-partition histogram risk
The universal bound is twice the mass-weighted squared oscillation plus six
times the number of positive-mass cells divided by m+1. Sampling may be
presented either as the canonical iid product law or as an independent family
on an arbitrary probability space with a common observation law. No density,
positive lower cell mass, or nonempty-sample premise is required.
A measurable finite partition and regression inputs, bounded responses and default, the population conditional mean identity, and within-cell oscillation bounds imply expected integrated squared histogram error is bounded by twice the mass-weighted squared oscillation plus six times the positive-cell count divided by the sample-size successor.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
histogram_risk_le_iidtheorem — Measurable iid observation maps with common law, measurable regression inputs, bounded responses and default, the conditional-mean identity, and cellwise oscillation bounds give the same integrated histogram risk bound on the original sample probability space.hypothesesΩ :sharedType u_1A :sharedType u_2κ :sharedType u_3m :ℕS :Type*μ :ν :Z :Fin m → S → Ωlabel :A → κX :Ω → AY :Ω → ℝg :A → ℝa :ℝδ :κ → ℝhZ :∀ r, Measurable (Z r)hind :iIndepFun Z νhident :∀ r, IdentDistrib (Z r) id ν μhlabel :Measurable labelhX :hY :hg :hbound :∀ᵐ ω ∂μ, Y ω ∈ Icc (0 : ℝ) 1ha :a ∈ Icc (0 : ℝ) 1hmean :ConditionalMean μ X Y ghδ :∀ k, 0 ≤ δ khosc :∀ k x x'iflabel x = kandlabel x' = kthen|g x - g x'| ≤ δ kconclusion(∫ s, (∫ ω, (histogram label X Y a (fun r => Z r s) (X ω) - g (X ω)) ^ 2 ∂μ) ∂ν)≤ 2 * (∑ k ∈ positiveCells μ label X, cellMass μ label X k * δ k ^ 2)+ 6 * ((positiveCells μ label X).card : ℝ) / (m + 1 : ℝ)Proof (Lean source)
theorem histogram_risk_le_iid {m : ℕ} {S : Type*} [MeasurableSpace S] (μ : Measure Ω) [IsProbabilityMeasure μ] (ν : Measure S) [IsProbabilityMeasure ν] (Z : Fin m → S → Ω) (label : A → κ) (X : Ω → A) (Y : Ω → ℝ) (g : A → ℝ) (a : ℝ) (δ : κ → ℝ) (hZ : ∀ r, Measurable (Z r)) (hind : iIndepFun Z ν) (hident : ∀ r, IdentDistrib (Z r) id ν μ) (hlabel : Measurable label) (hX : Measurable X) (hY : Measurable Y) (hg : Measurable g) (hbound : ∀ᵐ ω ∂μ, Y ω ∈ Icc (0 : ℝ) 1) (ha : a ∈ Icc (0 : ℝ) 1) (hmean : ConditionalMean μ X Y g) (hδ : ∀ k, 0 ≤ δ k) (hosc : ∀ k x x', label x = k → label x' = k → |g x - g x'| ≤ δ k) : (∫ s, (∫ ω, (histogram label X Y a (fun r => Z r s) (X ω) - g (X ω)) ^ 2 ∂μ) ∂ν) ≤ 2 * (∑ k ∈ positiveCells μ label X, cellMass μ label X k * δ k ^ 2) + 6 * ((positiveCells μ label X).card : ℝ) / (m + 1 : ℝ) := by -- The measurable integrated loss has the same expectation under the iid -- observation maps and the canonical product law, including sample size zero. rw [integral_histogram_loss_eq_risk_iid μ ν Z label X Y g a hZ hind hident hlabel hX hY hg] exact histogram_risk_le μ label X Y g a δ hlabel hX hY hg hbound ha hmean hδ hosc