introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
3.79 kB
import OAI.Probability.PosteriorReplicas.Model
namespace OAI
open MeasureTheory ProbabilityTheory Set Filter
open scoped ENNReal NNReal RealInnerProductSpace
noncomputable section
universe u
namespace PosteriorRegression
structure Learner (d M T : β„•) (Ξ© : Type u) where
initialChoice : Ξ© β†’ Bool Γ— State M
transition : β„• β†’ Ξ© β†’ State M β†’ (Vector d Γ— ℝ) β†’ Bool Γ— State M
output : β„• β†’ Ξ© β†’ State M β†’ UnitSphere d
namespace Learner
def start {d M T : β„•} {Ξ© : Type u} (L : Learner d M T Ξ©) (Ο‰ : Ξ©) :
RunStatus M :=
let a := L.initialChoice Ο‰
if a.1 then .inr (0, a.2) else .inl a.2
def run {d M T : β„•} {Ξ© : Type u} (L : Learner d M T Ξ©)
(s : UnitSphere d) (Ο‰ : Ξ©) (x : Samples d T) : β„• β†’ RunStatus M
| 0 => L.start Ο‰
| n + 1 =>
match L.run s Ο‰ x n with
| .inr done => .inr done
| .inl state =>
if hn : n < T then
let row := x ⟨n, hn⟩
let a := L.transition (n + 1) Ο‰ state (row, βŸͺrow, s.val⟫)
if a.1 then .inr (n + 1, a.2) else .inl a.2
else .inl state
def terminal {d M T : β„•} {Ξ© : Type u} (L : Learner d M T Ξ©)
(s : UnitSphere d) (Ο‰ : Ξ©) (x : Samples d T) : β„• Γ— State M :=
match L.run s Ο‰ x T with
| .inl state => (T, state)
| .inr done => done
def estimate {d M T : β„•} {Ξ© : Type u} (L : Learner d M T Ξ©)
(s : UnitSphere d) (Ο‰ : Ξ©) (x : Samples d T) : UnitSphere d :=
let a := L.terminal s Ο‰ x
L.output a.1 Ο‰ a.2
structure Admissible {d M T : β„•} {Ξ© : Type u} [MeasurableSpace Ξ©]
(L : Learner d M T Ω) (ρ : Measure Ω) : Prop where
initialChoice : AEMeasurable L.initialChoice ρ
transition : βˆ€ t a, AEMeasurable (fun z : Ξ© Γ— (Vector d Γ— ℝ) =>
L.transition t z.1 a z.2) (ρ.prod (observationReference d))
output : βˆ€ t a, AEMeasurable (fun Ο‰ => L.output t Ο‰ a) ρ
fixed_experiment : βˆ€ s, AEMeasurable (fun z : Ξ© Γ— Samples d T =>
L.estimate s z.1 z.2) (ρ.prod (sampleLaw d T))
uniform_experiment : AEMeasurable
(fun z : UnitSphere d Γ— (Ξ© Γ— Samples d T) => L.estimate z.1 z.2.1 z.2.2)
((uniformSphere d).prod (ρ.prod (sampleLaw d T)))
def success {d M T : β„•} {Ξ© : Type u} [MeasurableSpace Ξ©]
(L : Learner d M T Ξ©) (ρ : Measure Ξ©) (Ξ΅ : ℝ) (s : UnitSphere d) : ℝβ‰₯0∞ :=
(ρ.prod (sampleLaw d T))
{z | angularError s (L.estimate s z.1 z.2) ≀ Ξ΅}
def uniformSuccess {d M T : β„•} {Ξ© : Type u} [MeasurableSpace Ξ©]
(L : Learner d M T Ξ©) (ρ : Measure Ξ©) (Ξ΅ : ℝ) : ℝβ‰₯0∞ :=
((uniformSphere d).prod (ρ.prod (sampleLaw d T)))
{z | angularError z.1 (L.estimate z.1 z.2.1 z.2.2) ≀ Ξ΅}
end Learner
def SubquadraticMemory : Prop :=
βˆƒ c : ℝ, 0 < c ∧ βˆ€ M : β„• β†’ β„•,
Asymptotics.IsLittleO atTop (fun d => (M d : ℝ)) (fun d => (d : ℝ) ^ 2) β†’
βˆƒ dβ‚€ : β„•, βˆ€ d : β„•, dβ‚€ ≀ d β†’ βˆ€ T : β„•, βˆ€ Ξ΅ : ℝ,
0 < Ξ΅ β†’ Ξ΅ ≀ 1 / 10 β†’
βˆ€ (Ξ© : Type u) [MeasurableSpace Ξ©] (ρ : Measure Ξ©), IsProbabilityMeasure ρ β†’
βˆ€ L : Learner d (M d) T Ξ©, L.Admissible ρ β†’
((2 / 3 : ℝβ‰₯0∞) ≀ L.uniformSuccess ρ Ξ΅ ∨
βˆ€ s, (2 / 3 : ℝβ‰₯0∞) ≀ L.success ρ Ξ΅ s) β†’
c * (d : ℝ) * Real.log (1 / Ξ΅) ≀ (T : ℝ)
def FixedQuadraticMemory : Prop :=
βˆ€ Aβ‚€ : ℝ, 0 < Aβ‚€ β†’ βˆƒ c : ℝ, 0 < c ∧ βˆƒ dβ‚€ : β„•,
βˆ€ d : β„•, dβ‚€ ≀ d β†’ βˆ€ M T : β„•, (M : ℝ) ≀ Aβ‚€ * (d : ℝ) ^ 2 β†’
βˆ€ Ξ΅ : ℝ, 0 < Ξ΅ β†’ Ξ΅ ≀ 1 / 10 β†’
βˆ€ (Ξ© : Type u) [MeasurableSpace Ξ©] (ρ : Measure Ξ©), IsProbabilityMeasure ρ β†’
βˆ€ L : Learner d M T Ξ©, L.Admissible ρ β†’
(2 / 3 : ℝβ‰₯0∞) ≀ L.uniformSuccess ρ Ξ΅ β†’
c * (d : ℝ) * Real.log (1 / Ξ΅) ≀ (T : ℝ)
open scoped Topology
end PosteriorRegression
end
end OAI