Documentation

CslibFrontier.MachineLearning.StatisticalQuery.Basic

Learning from statistical queries #

In Kearns's statistical query model [Kea98] a learner does not see labelled examples of the unknown target c : X → Bool. Instead it asks an oracle for the expectations E_{x ∼ D} [φ (x, c x)] of bounded functions φ of a labelled example, and the oracle may answer any value within a tolerance τ of the truth. Here:

Kearns's queries are predicates χ : X × {0, 1} → {0, 1} and those of [Reyzin, Definition 2] [Rey20] take values in {-1, 1}; both are queries here, as are their affine images. Kearns attaches a tolerance to each query; a learner whose tolerances are all at least τ is in particular a learner with the single tolerance τ, so lower bounds for the single tolerance apply to it. As in Kearns's Definition 3 there is no confidence parameter: the oracle is adversarial but always within tolerance. A learner that is correct against every fixed answer function within tolerance (StatisticalQuery.LearnsStateless) is all that the lower bounds need, and every learner satisfying StatisticalQuery.Learns is one (StatisticalQuery.Learns.learnsStateless).

The correlation StatisticalQuery.corr D f g of two concepts is E_D [f · g] for their ±1 values (Cslib.BitString.signVal); it is 1 - 2 · disagreement D f g (StatisticalQuery.corr_eq_one_sub_two_mul_disagreement).

Main definitions #

Main results #

References #

A statistical query about labelled examples of X: a function of a point and its label with values in [-1, 1].

  • toFun : X → Bool → ℝ

    The value of the query at a point and a label.

  • abs_le_one' (x : X) (y : Bool) : |self.toFun x y| ≤ 1

    The values lie in [-1, 1].

Instances For
    @[instance_reducible]
    theorem Cslib.MachineLearning.StatisticalQuery.Query.abs_le_one {X : Type} (φ : Query X) (x : X) (y : Bool) :
    |φ.toFun x y| ≤ 1

    The values of a query lie in [-1, 1].

    @[reducible, inline]

    The interface of a statistical query learner: a query is answered by a real number.

    @[reducible, inline]

    A deterministic statistical query learner: a program making queries and returning a hypothesis.

    noncomputable def Cslib.MachineLearning.StatisticalQuery.expect {X : Type} [Fintype X] (D : PMF X) (c : X → Bool) (φ : Query X) :

    The expectation E_{x ∼ D} [φ (x, c x)] of the query φ on examples of the target c drawn from D.

    def Cslib.MachineLearning.StatisticalQuery.valid {X : Type} [Fintype X] (D : PMF X) (c : X → Bool) (τ : ℝ) (φ : Query X) :

    The answers to the query φ within the tolerance τ of its expectation.

    def Cslib.MachineLearning.StatisticalQuery.run {X : Type} (A : Algorithm X) (answer : Query X → ℝ) :
    X → Bool

    The hypothesis returned by the learner A when every query φ is answered by answer φ.

    noncomputable def Cslib.MachineLearning.StatisticalQuery.disagreement {X : Type} [Fintype X] (D : PMF X) (f g : X → Bool) :

    The D-probability that f and g disagree: the error of the hypothesis g for the target f, or of f for g.

    noncomputable def Cslib.MachineLearning.StatisticalQuery.corr {X : Type} [Fintype X] (D : PMF X) (f g : X → Bool) :

    The correlation E_D [f · g] of two concepts, read as ±1-valued functions.

    Correlation is one minus twice the disagreement.

    theorem Cslib.MachineLearning.StatisticalQuery.corr_comm {X : Type} [Fintype X] (D : PMF X) (f g : X → Bool) :
    corr D f g = corr D g f

    Correlation is symmetric.

    @[simp]
    theorem Cslib.MachineLearning.StatisticalQuery.corr_self {X : Type} [Fintype X] (D : PMF X) (f : X → Bool) :
    corr D f f = 1

    A concept has correlation 1 with itself.

    theorem Cslib.MachineLearning.StatisticalQuery.corr_not_right {X : Type} [Fintype X] (D : PMF X) (f g : X → Bool) :
    (corr D f fun (x : X) => !g x) = -corr D f g

    Negating a concept negates its correlations.

    The learner A learns the concept class C under D from statistical queries of tolerance τ with error ε: for every target c ∈ C, whatever answers within τ of the expectations the oracle gives, possibly depending on the earlier calls, the hypothesis disagrees with c with probability at most ε [Kearns1998, Definition 3].

    The learner A learns C under D with tolerance τ and error ε against every answer function within tolerance: an oracle answering each query by a fixed value within τ of its expectation. This is weaker than Learns (Learns.learnsStateless), so lower bounds stated for it apply to Learns.

    theorem Cslib.MachineLearning.StatisticalQuery.Learns.learnsStateless {X : Type} [Fintype X] {A : Algorithm X} {D : PMF X} {C : PACLearning.ConceptClass X Bool} {τ ε : ℝ} (h : Learns A D C τ ε) :
    LearnsStateless A D C τ ε

    A learner against adaptive answers is a learner against answer functions.

    theorem Cslib.MachineLearning.StatisticalQuery.Learns.mono {X : Type} [Fintype X] {A : Algorithm X} {D : PMF X} {C C' : PACLearning.ConceptClass X Bool} {τ τ' ε ε' : ℝ} (h : Learns A D C τ ε) (hC : C' ⊆ C) (hτ : τ' ≤ τ) (hε : ε ≤ ε') :
    Learns A D C' τ' ε'

    Learning is monotone: a smaller class, a smaller tolerance and a larger error.