Documentation

CslibFrontier.MachineLearning.UniformLearning.KushilevitzMansour

The Kushilevitz–Mansour algorithm #

The Kushilevitz–Mansour algorithm [KM93] O'Donnell, Section 3.5 learns, with membership queries, every Boolean function of small spectral norm ∑_S |f̂(S)| (UniformLearning.spectralNormClass); for instance every function computed by a small decision tree (UniformLearning.decisionTreeClass). It finds the large Fourier coefficients by the bucket search of Goldreich and Levin [GL89]: the bucket of a set S ⊆ J is the family of the sets U with U ∩ J = S, and its weight is the bucket weight (BitString.bucketWeight, O'Donnell's W^{S | J̄} with J̄ the complement of J). Starting from the bucket of all sets, the search adds the coordinates one at a time, splitting each surviving bucket S of J into the buckets S and insert i S of insert i J, and keeps the buckets whose estimated weight is at least θ² / 2 (UniformLearning.bucketSearch). On accurate estimates, the bucket search finds the heavy sets and keeps few buckets: a set U with |f̂(U)| ≥ θ contributes θ² to each of its buckets, so it is never discarded when every level's estimate of its bucket reaches the threshold (UniformLearning.inter_mem_bucketSearch), and when the estimates at a level are within θ² / 4 every surviving bucket weighs more than θ² / 4 (UniformLearning.lt_bucketWeight_of_mem_bucketSearch), so at most 4 / θ² buckets survive there (UniformLearning.mul_card_bucketSearch_le_one). At the last level a bucket is a single set U, of weight f̂(U)² (BitString.bucketWeight_univ). So if every estimate is within θ² / 4, the found sets satisfy the list guarantees of the Goldreich–Levin Theorem: every U with |f̂(U)| ≥ θ, only sets with |f̂(U)| > θ / 2, and at most 4 / θ² of them (UniformLearning.mem_kmCandidates_of_sq_le_sq, UniformLearning.lt_sq_of_mem_kmCandidates, UniformLearning.mul_card_kmCandidates_le_one). The search keeps a bucket whose estimate is at least θ² / 2, where the book discards one whose estimate is at most θ² / 2; the analysis is the same. With the sample bound below, the query tree UniformLearning.kmCandidatesTree, which makes at most m (2 n + 3) non-adaptive queries, outputs such sets except with probability δ from m ≥ (32 / θ⁴) log (2 (n + 2) 2 ^ n / δ) samples (UniformLearning.uniform_not_kmCandidatesTree_heavy_le_of_log). This is the query and sample step toward the Goldreich–Levin Theorem O'Donnell, Section 3.5, whose running time poly(n, 1 / θ) remains open on #2131 (see Cost). This is the Fourier form, with |f̂(U)|; Cslib.Crypto.GoldreichLevin has the hard-core predicate and an oracle-PPT list decoder for the strings of agreement at least 1 / 2 + ε, the signed form f̂(U) ≥ 2 ε.

The weights are estimated from samples (x, y, z) of three independent uniform points, as the average of f (x, z) χ_S(x) f (y, z) χ_S(y) (UniformLearning.bucketEstimate, BitString.bucketWeight_eq_expect_sample), where (x, z) takes the coordinates in J from x and the others from z. By Hoeffding's inequality one estimate from (2 / γ²) log (2 / δ) samples, reading f at two points each, is within γ except with probability δ (UniformLearning.uniform_abs_bucketEstimate_sub_ge_le_of_log), the sample bound in the proof of O'Donnell, Proposition 3.40. Here the same m samples serve every bucket of every level, so the queries are non-adaptive: the learner queries f at x and at the points (x, z), (y, z) of every sample and every level, m (2 n + 3) queries for n coordinates (UniformLearning.kmLearner_queriesAtMost), and then runs the search on the answers. The analysis takes a union bound over all 2 ^ n buckets of each level, which costs a factor n in the number of samples compared with fresh samples for each weighing. The hypothesis is the sign of the expansion on the found sets with coefficients estimated from the points x (UniformLearning.kmHypothesis, UniformLearning.kmLearner).

If all estimates are within θ² / 4 of their values, the hypothesis has error at most θ² / 4 plus the weight of the coefficients of absolute value below θ (UniformLearning.uniformError_kmHypothesis_le_add), since the found sets carry all the others; for a function of spectral norm at most L this weight is at most θ L (BitString.sum_fourierCoeff_sq_le_mul_sum_abs), so the error is at most θ² / 4 + θ L (UniformLearning.uniformError_kmHypothesis_le). Hoeffding's inequality and the union bound make the estimates accurate except with probability at most 2 (n + 2) 2 ^ n exp (-m θ⁴ / 32) (UniformLearning.uniform_not_accurate_le). With θ = ε / (2 L) this gives the query and sample step toward the Kushilevitz–Mansour theorem O'Donnell, Theorem 3.38: the functions of spectral norm at most L are learned with error ε and confidence 1 - δ from m ≥ (512 L⁴ / ε⁴) log (2 (n + 2) 2 ^ n / δ) samples, hence m (2 n + 3) membership queries, polynomial in n, L, 1 / ε and log (1 / δ) (UniformLearning.kmLearner_learns). The theorem's running time poly(n, L, 1 / ε) remains open on #2131 (see Cost). By the spectral norm bound for decision trees (DecisionTree.sum_abs_fourierCoeff_signVal_le_leafCount), this applies to the functions computed by decision trees with at most L leaves, the decision-tree case of Theorem 3.38 (UniformLearning.kmLearner_learns_decisionTree), with the same gap.

More generally, if the spectrum of f is ε / 4-concentrated on some collection of at most M sets (UniformLearning.concentratedClass), its coefficients below θ weigh at most ε / 4 + M θ² (BitString.sum_fourierCoeff_sq_le_sum_compl_add). With θ² = ε / (4 M) the algorithm learns such functions with error ε from m ≥ (512 M² / ε²) log (2 (n + 2) 2 ^ n / δ) samples, hence m (2 n + 3) membership queries, polynomial in n, M, 1 / ε and log (1 / δ) (UniformLearning.kmLearner_learns_concentrated). This is the query and sample step toward O'Donnell, Theorem 3.37; the theorem's running time poly(M, n, 1 / ε) remains open on #2131 (see Cost). The book's route (Exercise 3.39) applies the Goldreich–Levin list guarantee and then Theorem 3.29 to the listed sets; here the proof goes through the combined error bound on accurate samples (UniformLearning.uniformError_kmHypothesis_le_add) instead. Functions of spectral norm at most L are ε / 4-concentrated on about 4 L² / ε sets, but the spectral-norm step above, with its own threshold, needs fewer samples.

Cost. Only the numbers of samples and queries are certified; the running time is not certified by a machine model. On accurate samples the search computes at most 8 / θ² bucket estimates at each level, each from the m samples, and estimates at most 4 / θ² coefficients; this count of arithmetic operations is informal. The search has no cap on the number of buckets: the book bounds the active buckets by 4 / θ² only on accurate estimates, and UniformLearning.bucketSearch keeps every bucket whose estimate passes the threshold, so on inaccurate samples it can keep up to 2 ^ k buckets at level k and is not polynomial, even informally. The same holds for the query tree UniformLearning.kmCandidatesTree: its samples and queries are certified, its running time is not. Its bounds are those of the Kushilevitz–Mansour learner, so they are loose for listing the coefficients alone. It queries all of kmQueries ω: the 2 m points (x, z), (y, z) at each of the n + 1 levels, 2 m (n + 1) in all, which the search reads, plus the m points x that only the hypothesis reads, m (2 n + 3) in all. Its sample bound goes through KMAccurate, whose union bound counts 2 ^ n buckets at each of the n + 1 levels and also the 2 ^ n sample coefficients, (n + 2) 2 ^ n events; the search alone needs (n + 1) 2 ^ n.

Usage #

Open Cslib.MachineLearning.UniformLearning. A class C of Boolean functions whose spectra, read as signs, are ε / 4-concentrated on at most M ≥ 1 sets is a subset of concentratedClass ι M (ε / 4); apply UniformLearning.kmLearner_learns_concentrated_and_queriesAtMost with threshold √(ε / (4 M)) and any m at least (512 M² / ε²) log (2 (n + 2) 2 ^ n / δ) (for instance its ceiling), and restrict to C with QueryLearner.Learns.mono. This certifies the samples and queries of O'Donnell, Theorem 3.37, not its running time, which remains open on #2131. To bound the error of the hypothesis for another class, prove the samples accurate with UniformLearning.uniform_not_accurate_le_of_log and bound the weight of the small coefficients in UniformLearning.uniformError_kmHypothesis_le_add, for instance by BitString.sum_fourierCoeff_sq_le_sum_compl_add or BitString.sum_fourierCoeff_sq_le_mul_sum_abs. For a single bucket weight bucketWeight F J S, which is O'Donnell's W^{S | J̄}[F] for S ⊆ J and 0 otherwise, UniformLearning.uniform_abs_bucketEstimate_sub_ge_le_of_log takes m ≥ (2 / γ²) log (2 / δ) samples; the estimate reads f at 2 m points, but that theorem certifies neither queries nor time. Turning another tail bound c exp (-(a m)) into a sample size is Real.mul_exp_neg_le_of_log. To list the large Fourier coefficients of a Boolean function f with threshold τ > 0, take any m at least (32 / τ⁴) log (2 (n + 2) 2 ^ n / δ) and apply UniformLearning.uniform_not_kmCandidatesTree_heavy_le_of_log: except with probability δ over the samples ω, the list (kmCandidatesTree τ ω).eval f has the Goldreich–Levin guarantees, and UniformLearning.depth_kmCandidatesTree_le bounds its queries by m (2 n + 3); on samples known to be accurate, use UniformLearning.mem_kmCandidates_of_sq_le_sq, UniformLearning.lt_sq_of_mem_kmCandidates and UniformLearning.mul_card_kmCandidates_le_one directly. Checked clients show that a parity is concentrated on one set and not on none, that the small-coefficient bound is attained by a parity, bound the hypothesis error for parities, instantiate the sample bound on two bits, learn the parities through Learns.mono, instantiate the query and sample step for M = 3 on two bits, estimate two bucket weights of a parity, and find exactly a parity's own set with the query tree, on accurate samples and with probability 1 / 2 from ⌈32 log 64⌉ samples on two bits, in CslibFrontierTests/KushilevitzMansourConcentrated.lean; the spectral-norm and decision-tree steps are checked in CslibFrontierTests/FourierLearning.lean.

Main definitions #

Main results #

References #

The sets of coordinates weighed by the bucket search over the list l: the sets of coordinates of the suffixes of l, from l itself down to the empty list.

The coordinates of l are its first level.

noncomputable def Cslib.MachineLearning.UniformLearning.bucketSearch {ι : Type u_1} [DecidableEq ι] (est : Finset ι → Finset ι → ℝ) (τ : ℝ) :
List ι → Finset (Finset ι)

The bucket search of Goldreich–Levin and Kushilevitz–Mansour over the list l of coordinates, given estimates est J S of the bucket weights W^{S | J̄} and a threshold τ. Starting from the bucket of all sets, it adds the coordinates of l from the last to the first, splits each surviving bucket S of J into the buckets S and insert i S of insert i J, and keeps the buckets whose estimated weight is at least τ.

theorem Cslib.MachineLearning.UniformLearning.bucketSearch_congr {ι : Type u_1} [DecidableEq ι] {est est' : Finset ι → Finset ι → ℝ} {τ : ℝ} {l : List ι} (h : ∀ J ∈ searchLevels l, ∀ (S : Finset ι), est J S = est' J S) :
bucketSearch est τ l = bucketSearch est' τ l

The bucket search reads the estimates only at its levels.

theorem Cslib.MachineLearning.UniformLearning.le_of_mem_bucketSearch {ι : Type u_1} [DecidableEq ι] {est : Finset ι → Finset ι → ℝ} {τ : ℝ} {l : List ι} {S : Finset ι} (hS : S ∈ bucketSearch est τ l) :
τ ≤ est l.toFinset S

Every bucket kept by the search over l has estimated weight at least τ at the level of the coordinates of l.

theorem Cslib.MachineLearning.UniformLearning.inter_mem_bucketSearch {ι : Type u_1} [DecidableEq ι] {est : Finset ι → Finset ι → ℝ} {τ : ℝ} {l : List ι} {U : Finset ι} (h : ∀ J ∈ searchLevels l, τ ≤ est J (U ∩ J)) :
U ∩ l.toFinset ∈ bucketSearch est τ l

Completeness of the bucket search: if at every level J the bucket of U ∩ J has estimated weight at least τ, then the search over l keeps the bucket U ∩ l.

theorem Cslib.MachineLearning.UniformLearning.lt_bucketWeight_of_mem_bucketSearch {ι : Type u_1} [DecidableEq ι] [Fintype ι] (F : (ι → Bool) → ℝ) {θ : ℝ} {est : Finset ι → Finset ι → ℝ} {l : List ι} {S : Finset ι} (hW : |est l.toFinset S - BitString.bucketWeight F l.toFinset S| < θ ^ 2 / 4) (hS : S ∈ bucketSearch est (θ ^ 2 / 2) l) :

A kept bucket is heavy: if the estimate of the bucket weight of S at the level of the coordinates of l is within θ² / 4, and the search over l with threshold θ² / 2 keeps S, then the bucket weighs more than θ² / 4.

theorem Cslib.MachineLearning.UniformLearning.mul_card_bucketSearch_le_one {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → Bool) {θ : ℝ} (est : Finset ι → Finset ι → ℝ) (l : List ι) (hW : ∀ (S : Finset ι), |est l.toFinset S - BitString.bucketWeight (fun (x : ι → Bool) => BitString.signVal (f x)) l.toFinset S| < θ ^ 2 / 4) :
θ ^ 2 / 4 * ↑(bucketSearch est (θ ^ 2 / 2) l).card ≤ 1

Few buckets survive: if the estimates at the level of the coordinates of l are within θ² / 4 of the bucket weights of a Boolean function, then the search over l with threshold θ² / 2 keeps at most 4 / θ² buckets.

The algorithm #

The Boolean functions whose spectral norm ∑_S |f̂(S)|, read as signs, is at most L.

noncomputable def Cslib.MachineLearning.UniformLearning.bucketEstimate {ι : Type u_1} {m : ℕ} [DecidableEq ι] (g : (ι → Bool) → Bool) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) (J S : Finset ι) :

The empirical estimate of the bucket weight W^{S | J̄} of g, read as signs, from the samples ω j = (x, y, z): the average of g (x, z) χ_S(x) g (y, z) χ_S(y), where (x, z) takes the coordinates in J from x and the others from z.

noncomputable def Cslib.MachineLearning.UniformLearning.sampleCoeff {ι : Type u_1} {m : ℕ} (g : (ι → Bool) → Bool) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) (S : Finset ι) :

The empirical Fourier coefficient of g on S from the first points of the samples.

noncomputable def Cslib.MachineLearning.UniformLearning.kmCandidates {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (g : (ι → Bool) → Bool) (θ : ℝ) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) :

The sets found by the Kushilevitz–Mansour algorithm with threshold θ: the bucket search over all coordinates, keeping the buckets with estimated weight at least θ² / 2.

noncomputable def Cslib.MachineLearning.UniformLearning.kmHypothesis {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (g : (ι → Bool) → Bool) (θ : ℝ) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) :
(ι → Bool) → Bool

The hypothesis of the Kushilevitz–Mansour algorithm: the sign of the expansion on the found sets, with the empirical coefficients of the samples.

noncomputable def Cslib.MachineLearning.UniformLearning.kmQueries {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) :
List (ι → Bool)

The points queried by the Kushilevitz–Mansour algorithm: the first point x of each sample, and the points (x, z) and (y, z) of each sample (x, y, z) at every level J of the search.

theorem Cslib.MachineLearning.UniformLearning.length_kmQueries {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) :
(kmQueries ω).length = m * (2 * Fintype.card ι + 3)

The algorithm queries m (2 n + 3) points for n coordinates.

theorem Cslib.MachineLearning.UniformLearning.kmCandidates_congr {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (θ : ℝ) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) {g g' : (ι → Bool) → Bool} (h : ∀ x ∈ kmQueries ω, g x = g' x) :
kmCandidates g θ ω = kmCandidates g' θ ω

The found sets depend only on the values of the target at the queried points.

theorem Cslib.MachineLearning.UniformLearning.kmHypothesis_congr {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (θ : ℝ) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) {g g' : (ι → Bool) → Bool} (h : ∀ x ∈ kmQueries ω, g x = g' x) :
kmHypothesis g θ ω = kmHypothesis g' θ ω

The hypothesis depends only on the answers at the queried points.

noncomputable def Cslib.MachineLearning.UniformLearning.kmLearner (ι : Type u_1) (m : ℕ) [Fintype ι] [DecidableEq ι] (θ : ℝ) :
QueryLearner ι (Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool))

The Kushilevitz–Mansour algorithm with threshold θ from m samples: draw m independent samples of three uniform points, query the target at the points kmQueries, run the bucket search with threshold θ² / 2 on the estimated bucket weights, and output the sign of the expansion on the found sets with estimated coefficients. Its queries are non-adaptive.

theorem Cslib.MachineLearning.UniformLearning.eval_kmLearner {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (θ : ℝ) (f : (ι → Bool) → Bool) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) :
(kmLearner ι m θ ω).eval f = kmHypothesis f θ ω

Run on the target f, the algorithm outputs kmHypothesis f θ ω.

The Kushilevitz–Mansour algorithm makes m (2 n + 3) membership queries for n coordinates.

noncomputable def Cslib.MachineLearning.UniformLearning.kmCandidatesTree {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (θ : ℝ) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) :
DecisionTree (ι → Bool) (Finset (Finset ι))

The Goldreich–Levin bucket search with threshold θ on the samples ω, as a query tree: query the target at the points kmQueries ω, then output the sets found by the bucket search on the answers. Its queries are non-adaptive; its running time is not certified.

theorem Cslib.MachineLearning.UniformLearning.eval_kmCandidatesTree {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (θ : ℝ) (f : (ι → Bool) → Bool) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) :

Run on the target f, the query tree outputs kmCandidates f θ ω.

theorem Cslib.MachineLearning.UniformLearning.depth_kmCandidatesTree_le {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (θ : ℝ) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) :

The query tree makes at most m (2 n + 3) membership queries for n coordinates.

The analysis #

def Cslib.MachineLearning.UniformLearning.KMAccurate {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) (γ : ℝ) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) :

The samples ω are accurate for f at precision γ: every bucket estimate at every level of the search over all coordinates, and every sample coefficient, is within γ of its value.

theorem Cslib.MachineLearning.UniformLearning.mem_kmCandidates_of_sq_le_sq {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) {θ : ℝ} {ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)} (hω : KMAccurate f (θ ^ 2 / 4) ω) {U : Finset ι} (hU : θ ^ 2 ≤ BitString.fourierCoeff (fun (x : ι → Bool) => BitString.signVal (f x)) U ^ 2) :
U ∈ kmCandidates f θ ω

On samples accurate at precision θ² / 4, the found sets include every set whose coefficient has square at least θ².

theorem Cslib.MachineLearning.UniformLearning.lt_sq_of_mem_kmCandidates {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) {θ : ℝ} {ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)} (hω : KMAccurate f (θ ^ 2 / 4) ω) {U : Finset ι} (hU : U ∈ kmCandidates f θ ω) :
θ ^ 2 / 4 < BitString.fourierCoeff (fun (x : ι → Bool) => BitString.signVal (f x)) U ^ 2

On samples accurate at precision θ² / 4, every found set has a coefficient of square above θ² / 4: at the last level a bucket is a single set, of weight f̂(U)².

theorem Cslib.MachineLearning.UniformLearning.mul_card_kmCandidates_le_one {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) {θ : ℝ} {ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)} (hω : KMAccurate f (θ ^ 2 / 4) ω) :
θ ^ 2 / 4 * ↑(kmCandidates f θ ω).card ≤ 1

On samples accurate at precision θ² / 4, at most 4 / θ² sets are found.

theorem Cslib.MachineLearning.UniformLearning.uniformError_kmHypothesis_le_add {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) {θ : ℝ} (hθ : 0 < θ) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) (hω : KMAccurate f (θ ^ 2 / 4) ω) :
uniformError f (kmHypothesis f θ ω) ≤ θ ^ 2 / 4 + ∑ S : Finset ι with BitString.fourierCoeff (fun (x : ι → Bool) => BitString.signVal (f x)) S ^ 2 < θ ^ 2, BitString.fourierCoeff (fun (x : ι → Bool) => BitString.signVal (f x)) S ^ 2

The Kushilevitz–Mansour algorithm on accurate samples. Let θ > 0. If the samples are accurate at precision θ² / 4, then the hypothesis has error at most θ² / 4 plus the Fourier weight of f, read as signs, on the sets whose coefficient has absolute value below θ.

theorem Cslib.MachineLearning.UniformLearning.uniformError_kmHypothesis_le {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) {L θ : ℝ} (hθ : 0 < θ) (hL : ∑ S : Finset ι, |BitString.fourierCoeff (fun (x : ι → Bool) => BitString.signVal (f x)) S| ≤ L) (ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool)) (hω : KMAccurate f (θ ^ 2 / 4) ω) :
uniformError f (kmHypothesis f θ ω) ≤ θ ^ 2 / 4 + θ * L

The Kushilevitz–Mansour algorithm on accurate samples, for small spectral norm. Let the spectral norm of f, read as signs, be at most L, and let θ > 0. If the samples are accurate at precision θ² / 4, then the hypothesis has error at most θ² / 4 + θ L.

theorem Cslib.MachineLearning.UniformLearning.uniform_abs_bucketEstimate_sub_ge_le {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) (J S : Finset ι) {γ : ℝ} (hγ : 0 ≤ γ) :
(Probability.PMF.uniformOfFintype (Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool))).toOuterMeasure {ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool) | γ ≤ |bucketEstimate f ω J S - BitString.bucketWeight (fun (x : ι → Bool) => BitString.signVal (f x)) J S|} ≤ ENNReal.ofReal (2 * Real.exp (-(↑m * γ ^ 2) / 2))

Estimating a bucket weight, the sample bound in the proof of O'Donnell, Proposition 3.40: from m samples of three independent uniform points, the empirical bucket weight of f on S with respect to J is off from the bucket weight of f read as signs, O'Donnell's W^{S | J̄}[f] when S ⊆ J and 0 otherwise, by at least γ with probability at most 2 exp (-m γ² / 2), by Hoeffding's inequality. The estimate reads f at the two points (x, z) and (y, z) of each sample.

theorem Cslib.MachineLearning.UniformLearning.uniform_abs_bucketEstimate_sub_ge_le_of_log {ι : Type u_1} {m : ℕ} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) (J S : Finset ι) {γ δ : ℝ} (hγ : 0 < γ) (hδ : 0 < δ) (hm : 2 / γ ^ 2 * Real.log (2 / δ) ≤ ↑m) :
(Probability.PMF.uniformOfFintype (Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool))).toOuterMeasure {ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool) | γ ≤ |bucketEstimate f ω J S - BitString.bucketWeight (fun (x : ι → Bool) => BitString.signVal (f x)) J S|} ≤ ENNReal.ofReal δ

Estimating a bucket weight with confidence, the sample bound in the proof of O'Donnell, Proposition 3.40: from m ≥ (2 / γ²) log (2 / δ) samples, the empirical bucket weight is within γ of W^{S | J̄}[f] for S ⊆ J (and of 0 otherwise) except with probability at most δ. The estimate reads f at 2 m points; queries and time are not certified here.

theorem Cslib.MachineLearning.UniformLearning.uniform_not_accurate_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) (θ : ℝ) (m : ℕ) :
(Probability.PMF.uniformOfFintype (Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool))).toOuterMeasure {ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool) | ¬KMAccurate f (θ ^ 2 / 4) ω} ≤ ENNReal.ofReal (2 * (↑(Fintype.card ι) + 2) * 2 ^ Fintype.card ι * Real.exp (-(↑m * θ ^ 4) / 32))

The samples are accurate with high probability: m samples fail to be accurate at precision θ² / 4 with probability at most 2 (n + 2) 2 ^ n exp (-m θ⁴ / 32) for n coordinates.

theorem Cslib.MachineLearning.UniformLearning.uniform_not_accurate_le_of_log {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) {θ δ : ℝ} (hθ : 0 < θ) (hδ : 0 < δ) {m : ℕ} (hm : 32 / θ ^ 4 * Real.log (2 * (↑(Fintype.card ι) + 2) * 2 ^ Fintype.card ι / δ) ≤ ↑m) :
(Probability.PMF.uniformOfFintype (Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool))).toOuterMeasure {ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool) | ¬KMAccurate f (θ ^ 2 / 4) ω} ≤ ENNReal.ofReal δ

Enough samples are accurate: for n coordinates, θ > 0 and δ > 0, from m ≥ (32 / θ⁴) log (2 (n + 2) 2 ^ n / δ) samples, the samples fail to be accurate at precision θ² / 4 with probability at most δ.

theorem Cslib.MachineLearning.UniformLearning.uniform_not_kmCandidatesTree_heavy_le_of_log {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) {τ δ : ℝ} (hτ : 0 < τ) (hδ : 0 < δ) {m : ℕ} (hm : 32 / τ ^ 4 * Real.log (2 * (↑(Fintype.card ι) + 2) * 2 ^ Fintype.card ι / δ) ≤ ↑m) :
(Probability.PMF.uniformOfFintype (Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool))).toOuterMeasure {ω : Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool) | ¬((∀ (U : Finset ι), τ ≤ |BitString.fourierCoeff (fun (x : ι → Bool) => BitString.signVal (f x)) U| → U ∈ (kmCandidatesTree τ ω).eval f) ∧ (∀ U ∈ (kmCandidatesTree τ ω).eval f, τ / 2 < |BitString.fourierCoeff (fun (x : ι → Bool) => BitString.signVal (f x)) U|) ∧ τ ^ 2 / 4 * ↑((kmCandidatesTree τ ω).eval f).card ≤ 1)} ≤ ENNReal.ofReal δ

Listing the large Fourier coefficients by the bucket search of Goldreich and Levin [GL89], the query and sample step toward the Goldreich–Levin Theorem O'Donnell, Section 3.5: for n coordinates and τ > 0, from m ≥ (32 / τ⁴) log (2 (n + 2) 2 ^ n / δ) uniform samples, except with probability at most δ, the query tree kmCandidatesTree τ ω run on the target f outputs every set U with |f̂(U)| ≥ τ, only sets with |f̂(U)| > τ / 2, and at most 4 / τ² sets. The tree makes at most m (2 n + 3) non-adaptive membership queries (depth_kmCandidatesTree_le), polynomially many in n, 1 / τ and log (1 / δ); these bounds are loose for the search alone (see Cost in the module docstring). Only samples and queries are certified: the book's poly(n, 1 / τ) running time is not, and the bucket search has no cap on the number of buckets, so it remains open on #2131.

theorem Cslib.MachineLearning.UniformLearning.kmLearner_learns {ι : Type u_1} [Fintype ι] [DecidableEq ι] {L ε δ : ℝ} (hε : 0 < ε) (hδ : 0 < δ) {m : ℕ} (hm : 512 * L ^ 4 / ε ^ 4 * Real.log (2 * (↑(Fintype.card ι) + 2) * 2 ^ Fintype.card ι / δ) ≤ ↑m) :
(kmLearner ι m (ε / (2 * L))).Learns (Probability.PMF.uniformOfFintype (Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool))) (spectralNormClass ι L) ε δ

The query and sample step toward the Kushilevitz–Mansour theorem [KM93], O'Donnell, Theorem 3.38: for n coordinates, the Kushilevitz–Mansour algorithm with threshold ε / (2 L) from m ≥ (512 L⁴ / ε⁴) log (2 (n + 2) 2 ^ n / δ) samples, hence m (2 n + 3) membership queries (kmLearner_queriesAtMost), learns the Boolean functions whose spectral norm, read as signs, is at most L, with error ε and confidence 1 - δ. Only samples and queries are certified: the book's running time poly(n, L, 1 / ε) is not, and the bucket search has no cap on the number of buckets, so it remains open on #2131.

theorem Cslib.MachineLearning.UniformLearning.kmLearner_learns_decisionTree {ι : Type u_1} [Fintype ι] [DecidableEq ι] {L : ℕ} {ε δ : ℝ} (hε : 0 < ε) (hδ : 0 < δ) {m : ℕ} (hm : 512 * ↑L ^ 4 / ε ^ 4 * Real.log (2 * (↑(Fintype.card ι) + 2) * 2 ^ Fintype.card ι / δ) ≤ ↑m) :
(kmLearner ι m (ε / (2 * ↑L))).Learns (Probability.PMF.uniformOfFintype (Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool))) (decisionTreeClass ι L) ε δ

The query and sample step toward learning decision trees with membership queries [KM93], the decision-tree case of O'Donnell, Theorem 3.38: for n coordinates, the Kushilevitz–Mansour algorithm with threshold ε / (2 L) from m ≥ (512 L⁴ / ε⁴) log (2 (n + 2) 2 ^ n / δ) samples, hence m (2 n + 3) membership queries, learns the functions computed by decision trees with at most L leaves, with error ε and confidence 1 - δ. Only samples and queries are certified; the book's running time poly(n, L, 1 / ε) remains open on #2131.

theorem Cslib.MachineLearning.UniformLearning.kmLearner_learns_and_queriesAtMost {ι : Type u_1} [Fintype ι] [DecidableEq ι] {L ε δ : ℝ} (hε : 0 < ε) (hδ : 0 < δ) {m : ℕ} (hm : 512 * L ^ 4 / ε ^ 4 * Real.log (2 * (↑(Fintype.card ι) + 2) * 2 ^ Fintype.card ι / δ) ≤ ↑m) :
(kmLearner ι m (ε / (2 * L))).Learns (Probability.PMF.uniformOfFintype (Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool))) (spectralNormClass ι L) ε δ ∧ (kmLearner ι m (ε / (2 * L))).QueriesAtMost (m * (2 * Fintype.card ι + 3))

The query and sample step toward the Kushilevitz–Mansour theorem, with the query count: under the hypotheses of kmLearner_learns, the algorithm learns the functions of spectral norm at most L with m (2 n + 3) membership queries for n coordinates, the samples and queries of O'Donnell, Theorem 3.38. Its running time remains open on #2131.

theorem Cslib.MachineLearning.UniformLearning.kmLearner_learns_decisionTree_and_queriesAtMost {ι : Type u_1} [Fintype ι] [DecidableEq ι] {L : ℕ} {ε δ : ℝ} (hε : 0 < ε) (hδ : 0 < δ) {m : ℕ} (hm : 512 * ↑L ^ 4 / ε ^ 4 * Real.log (2 * (↑(Fintype.card ι) + 2) * 2 ^ Fintype.card ι / δ) ≤ ↑m) :
(kmLearner ι m (ε / (2 * ↑L))).Learns (Probability.PMF.uniformOfFintype (Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool))) (decisionTreeClass ι L) ε δ ∧ (kmLearner ι m (ε / (2 * ↑L))).QueriesAtMost (m * (2 * Fintype.card ι + 3))

The query and sample step toward learning decision trees with membership queries, with the query count: under the hypotheses of kmLearner_learns_decisionTree, the algorithm learns the functions computed by decision trees with at most L leaves with m (2 n + 3) membership queries for n coordinates, the samples and queries of the decision-tree case of O'Donnell, Theorem 3.38. Its running time remains open on #2131.

Concentrated classes #

The Boolean functions whose Fourier spectrum, read as signs, is η-concentrated on some collection of at most M sets: the weight off the collection is at most η O'Donnell, Definition 3.28.

theorem Cslib.MachineLearning.UniformLearning.kmLearner_learns_concentrated {ι : Type u_1} [Fintype ι] [DecidableEq ι] {M : ℕ} (hM : 0 < M) {ε δ : ℝ} (hε : 0 < ε) (hδ : 0 < δ) {m : ℕ} (hm : 512 * ↑M ^ 2 / ε ^ 2 * Real.log (2 * (↑(Fintype.card ι) + 2) * 2 ^ Fintype.card ι / δ) ≤ ↑m) :
(kmLearner ι m √(ε / (4 * ↑M))).Learns (Probability.PMF.uniformOfFintype (Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool))) (concentratedClass ι M (ε / 4)) ε δ

Learning concentrated classes with membership queries [KM93], the query and sample step toward O'Donnell, Theorem 3.37: for n coordinates and M ≥ 1, the Kushilevitz–Mansour algorithm with threshold √(ε / (4 M)) from m ≥ (512 M² / ε²) log (2 (n + 2) 2 ^ n / δ) samples, hence m (2 n + 3) membership queries (kmLearner_queriesAtMost), learns, with error ε and confidence 1 - δ, the Boolean functions whose Fourier spectrum, read as signs, is ε / 4-concentrated on at most M sets. Only samples and queries are certified: the book's running time poly(M, n, 1 / ε) is not, and the bucket search has no cap on the number of buckets, so it remains open on #2131.

theorem Cslib.MachineLearning.UniformLearning.kmLearner_learns_concentrated_and_queriesAtMost {ι : Type u_1} [Fintype ι] [DecidableEq ι] {M : ℕ} (hM : 0 < M) {ε δ : ℝ} (hε : 0 < ε) (hδ : 0 < δ) {m : ℕ} (hm : 512 * ↑M ^ 2 / ε ^ 2 * Real.log (2 * (↑(Fintype.card ι) + 2) * 2 ^ Fintype.card ι / δ) ≤ ↑m) :
(kmLearner ι m √(ε / (4 * ↑M))).Learns (Probability.PMF.uniformOfFintype (Fin m → (ι → Bool) × (ι → Bool) × (ι → Bool))) (concentratedClass ι M (ε / 4)) ε δ ∧ (kmLearner ι m √(ε / (4 * ↑M))).QueriesAtMost (m * (2 * Fintype.card ι + 3))

Learning concentrated classes, with the query count: under the hypotheses of kmLearner_learns_concentrated, the algorithm learns the functions ε / 4-concentrated on at most M sets with m (2 n + 3) membership queries for n coordinates: the query and sample step toward O'Donnell, Theorem 3.37. Only samples and queries are certified; the book's running time poly(M, n, 1 / ε) remains open on #2131.