Documentation

LeanMachineLearning.SequentialLearning.IdentificationAlg

Identification algorithms: sampling rule, stopping rule, output rule #

An identification algorithm A : IdentAlg š“ž š“ š“Ø š““ with outputs in š““ is a sampling rule A.alg : Algorithm š“ž š“ š“Ø together with

A run of the algorithm in an environment env, on a probability space (Ī©, P), consists of observation, action and feedback processes O, X, Y forming an algorithm-environment sequence for A.alg and env (IsAlgEnvSeq) and an output out : Ī© → š““ whose conditional law given the history at the stopping time is the output rule (IdentAlg.IsRun).

The law of the output of a run is determined by A and env: it is A.outputMeasure env, see IdentAlg.IsRun.hasLaw_output. Properties of the algorithm are stated in terms of this law: A is PAC at level Ī“ (IdentAlg.IsPAC) for a family of environments env Īø and a badness predicate bad Īø if, for every Īø, the output in env Īø is bad Īø with probability at most Ī“.

Main definitions #

Time is 0-indexed: after n rounds the actions a_0, …, a_{n-1} have been played.

structure Learning.IdentAlg (š“ž : Type u_6) (š“ : Type u_7) (š“Ø : Type u_8) (š““ : Type u_9) [MeasurableSpace š“ž] [MeasurableSpace š“] [MeasurableSpace š“Ø] [MeasurableSpace š““] :
Type (max (max (max u_6 u_7) u_8) u_9)

An identification algorithm with outputs in š““: a sampling rule alg, a stopping rule stopSet (the algorithm stops after n rounds if the history of these rounds belongs to stopSet) and an output rule output, a Markov kernel giving the distribution of the output given the history of the rounds played.

Instances For
    instance Learning.IdentAlg.instIsMarkovKernelSigmaNatHistOutput {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} {A : IdentAlg š“ž š“ š“Ø š““} :
    noncomputable def Learning.IdentAlg.stoppingTime {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {Ī© : Type u_5} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} (A : IdentAlg š“ž š“ š“Ø š““) (O : ā„• → Ī© → š“ž) (X : ā„• → Ī© → š“) (Y : ā„• → Ī© → š“Ø) :
    Ī© → ā„•āˆž

    The stopping time of A on the observation, action and feedback processes O, X, Y: the number of rounds played, that is the first n such that the history of the first n rounds belongs to the stopping rule A.stopSet (⊤ if there is none).

    Equations
    Instances For
      theorem Learning.IdentAlg.stoppingTime_def {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {Ī© : Type u_5} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} {O : ā„• → Ī© → š“ž} {X : ā„• → Ī© → š“} {Y : ā„• → Ī© → š“Ø} {A : IdentAlg š“ž š“ š“Ø š““} :
      noncomputable def Learning.IdentAlg.stoppedHist {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {Ī© : Type u_5} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} (A : IdentAlg š“ž š“ š“Ø š““) (O : ā„• → Ī© → š“ž) (X : ā„• → Ī© → š“) (Y : ā„• → Ī© → š“Ø) :
      Ī© → (n : ā„•) Ɨ Hist š“ž š“ š“Ø n

      The history of the rounds played by an identification algorithm A, as a history of variable length: the history stopped at A.stoppingTime O X Y (the history of an arbitrary number of rounds if A never stops).

      Equations
      Instances For
        theorem Learning.IdentAlg.stoppedHist_def {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {Ī© : Type u_5} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} {O : ā„• → Ī© → š“ž} {X : ā„• → Ī© → š“} {Y : ā„• → Ī© → š“Ø} {A : IdentAlg š“ž š“ š“Ø š““} :
        noncomputable def Learning.IdentAlg.outputMeasure {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} (A : IdentAlg š“ž š“ š“Ø š““) (env : Environment š“ž š“ š“Ø) :

        The law of the output of an identification algorithm in an environment.

        Equations
        Instances For
          instance Learning.IdentAlg.instIsProbabilityMeasureOutputMeasure {š“ž : Type u_2} {š“ : Type u_3} {š“Ø : Type u_4} {š““ : Type u_1} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} (A : IdentAlg š“ž š“ š“Ø š““) (env : Environment š“ž š“ š“Ø) :
          structure Learning.IdentAlg.IsRun {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {Ī© : Type u_5} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} {mĪ© : MeasurableSpace Ī©} (A : IdentAlg š“ž š“ š“Ø š““) (env : Environment š“ž š“ š“Ø) (O : ā„• → Ī© → š“ž) (X : ā„• → Ī© → š“) (Y : ā„• → Ī© → š“Ø) (out : Ī© → š““) (P : MeasureTheory.Measure Ī© := by volume_tac) [MeasureTheory.IsFiniteMeasure P] :

          (O, X, Y, out) is a run of the identification algorithm A in the environment env on the probability space (Ī©, P): the observation, action and feedback processes O, X, Y form an algorithm-environment sequence for the sampling rule A.alg and env, and the output out has conditional law A.output given the history at the stopping time.

          Instances For
            theorem Learning.IdentAlg.isStoppingTime_stoppingTime {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {Ī© : Type u_5} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} {mĪ© : MeasurableSpace Ī©} {O : ā„• → Ī© → š“ž} {X : ā„• → Ī© → š“} {Y : ā„• → Ī© → š“Ø} {env : Environment š“ž š“ š“Ø} {P : MeasureTheory.Measure Ī©} (A : IdentAlg š“ž š“ š“Ø š““) {alg : Algorithm š“ž š“ š“Ø} [MeasureTheory.IsFiniteMeasure P] (h : IsAlgEnvSeq O X Y alg env P) :

            The stopping time of an identification algorithm A is a stopping time of the history filtration of any algorithm-environment sequence O, X, Y. Most often used with alg = A.alg.

            theorem Learning.IdentAlg.stoppedHist_mem_stopSet_of_ne_top {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {Ī© : Type u_5} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} {O : ā„• → Ī© → š“ž} {X : ā„• → Ī© → š“} {Y : ā„• → Ī© → š“Ø} {A : IdentAlg š“ž š“ š“Ø š““} {ω : Ī©} (h : A.stoppingTime O X Y ω ≠ ⊤) :
            A.stoppedHist O X Y ω ∈ A.stopSet
            theorem Learning.IdentAlg.IsRun.hasLaw_stoppedHist {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {Ī© : Type u_5} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} {mĪ© : MeasurableSpace Ī©} {O : ā„• → Ī© → š“ž} {X : ā„• → Ī© → š“} {Y : ā„• → Ī© → š“Ø} {A : IdentAlg š“ž š“ š“Ø š““} {env : Environment š“ž š“ š“Ø} {out : Ī© → š““} {P : MeasureTheory.Measure Ī©} [MeasureTheory.IsProbabilityMeasure P] (h : A.IsRun env O X Y out P) :

            The history at the stopping time of any run of A in env has law stoppedHistMeasure A.alg env A.stopSet.

            theorem Learning.IdentAlg.IsRun.hasLaw_output {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {Ī© : Type u_5} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} {mĪ© : MeasurableSpace Ī©} {O : ā„• → Ī© → š“ž} {X : ā„• → Ī© → š“} {Y : ā„• → Ī© → š“Ø} {A : IdentAlg š“ž š“ š“Ø š““} {env : Environment š“ž š“ š“Ø} {out : Ī© → š““} {P : MeasureTheory.Measure Ī©} [MeasureTheory.IsProbabilityMeasure P] (h : A.IsRun env O X Y out P) :

            The output of any run of A in env has law A.outputMeasure env.

            def Learning.IdentAlg.IsPAC {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} {Θ : Type u_6} (A : IdentAlg š“ž š“ š“Ø š““) (env : Θ → Environment š“ž š“ š“Ø) (bad : Θ → š““ → Prop) (Ī“ : ā„) :

            A is PAC at level Ī“ for the family of environments env : Θ → Environment š“ž š“ š“Ø and the predicate bad : Θ → š““ → Prop if, for every Īø, the output of A in env Īø is bad Īø with probability at most Ī“. See IsPAC.measureReal_not_good_of_isRun for the corresponding statement about any run of A.

            Equations
            Instances For
              theorem Learning.IdentAlg.IsPAC.measureReal_bad_of_isRun {š“ž : Type u_1} {š“ : Type u_2} {š“Ø : Type u_3} {š““ : Type u_4} {Ī© : Type u_5} {mš“ž : MeasurableSpace š“ž} {mš“ : MeasurableSpace š“} {mš“Ø : MeasurableSpace š“Ø} {mš““ : MeasurableSpace š““} {mĪ© : MeasurableSpace Ī©} {O : ā„• → Ī© → š“ž} {X : ā„• → Ī© → š“} {Y : ā„• → Ī© → š“Ø} {A : IdentAlg š“ž š“ š“Ø š““} {out : Ī© → š““} {P : MeasureTheory.Measure Ī©} {Θ : Type u_6} {env : Θ → Environment š“ž š“ š“Ø} {bad : Θ → š““ → Prop} {Ī“ : ā„} [MeasureTheory.IsProbabilityMeasure P] (hA : A.IsPAC env bad Ī“) {Īø : Θ} (hbad : MeasurableSet {d : š““ | bad Īø d}) (h : A.IsRun (env Īø) O X Y out P) :
              P.real {ω : Ī© | bad Īø (out ω)} ≤ Ī“

              For a PAC algorithm at level Ī“, the output of any run in env Īø is bad Īø with probability at most Ī“.