LeanMachineLearning exposition

Bandits.pullCount_eq_comp๐Ÿ”—

This page has the declaration's own card below, then its dependency graph, then a card for each dependency (type dependencies first, then the rest of the transitive closure). For a theorem, the graph and the dependency cards only follow its statement's dependencies (its proof is replaced by sorry, so what it proves doesn't depend on how); for everything else, both the type and the body/value are followed, since their content is part of what later declarations build on.

Minimal Lean file

pullCount_eq_comp๐Ÿ”—

LemmaBandits.pullCount_eq_comp

No docstring.

๐Ÿ”—theorem
Bandits.pullCount_eq_comp.{u_1, u_2} {๐“ : Type u_1} {ฮฉ : Type u_2} [DecidableEq ๐“] {A : โ„• โ†’ ฮฉ โ†’ ๐“} {R : โ„• โ†’ ฮฉ โ†’ โ„} {n : โ„•} {a : ๐“} : Learning.pullCount A a n = (fun p => โˆ‘ i โˆˆ Finset.range n, if Prod.fst (p i) = a then 1 else 0) โˆ˜ Learning.trajectory A R
Bandits.pullCount_eq_comp.{u_1, u_2} {๐“ : Type u_1} {ฮฉ : Type u_2} [DecidableEq ๐“] {A : โ„• โ†’ ฮฉ โ†’ ๐“} {R : โ„• โ†’ ฮฉ โ†’ โ„} {n : โ„•} {a : ๐“} : Learning.pullCount A a n = (fun p => โˆ‘ i โˆˆ Finset.range n, if Prod.fst (p i) = a then 1 else 0) โˆ˜ Learning.trajectory A R

Code

lemma pullCount_eq_comp :
    pullCount A a n =
      (fun p โ†ฆ โˆ‘ i โˆˆ range n, if (p i).1 = a then 1 else 0) โˆ˜ (trajectory A R)
Type uses (2)
Used by (1)

Actions: Source ยท Open Issue

Proof
by
  ext
  simp [pullCount, trajectory]

Dependency graph

Type dependencies (2)

pullCount๐Ÿ”—

DefinitionLearning.pullCount

Number of times action a was chosen up to time t (excluding t).

๐Ÿ”—def
Learning.pullCount.{u_1, u_3} {๐“ : Type u_1} {ฮฉ : Type u_3} [DecidableEq ๐“] (A : โ„• โ†’ ฮฉ โ†’ ๐“) (a : ๐“) (t : โ„•) (ฯ‰ : ฮฉ) : โ„•
Learning.pullCount.{u_1, u_3} {๐“ : Type u_1} {ฮฉ : Type u_3} [DecidableEq ๐“] (A : โ„• โ†’ ฮฉ โ†’ ๐“) (a : ๐“) (t : โ„•) (ฯ‰ : ฮฉ) : โ„•

Code

noncomputable
def pullCount (A : โ„• โ†’ ฮฉ โ†’ ๐“) (a : ๐“) (t : โ„•) (ฯ‰ : ฮฉ) : โ„• :=
  #(filter (fun s โ†ฆ A s ฯ‰ = a) (range t))
Used by (146)

Actions: Source ยท Open Issue

trajectory๐Ÿ”—

DefinitionLearning.trajectory

A random variable that gives the sequence of action-feedback pairs.

๐Ÿ”—def
Learning.trajectory.{u_1, u_2, u_3} {๐“ : Type u_1} {๐“จ : Type u_2} {ฮฉ : Type u_3} (A : โ„• โ†’ ฮฉ โ†’ ๐“) (Y : โ„• โ†’ ฮฉ โ†’ ๐“จ) (ฯ‰ : ฮฉ) : โ„• โ†’ ๐“ ร— ๐“จ
Learning.trajectory.{u_1, u_2, u_3} {๐“ : Type u_1} {๐“จ : Type u_2} {ฮฉ : Type u_3} (A : โ„• โ†’ ฮฉ โ†’ ๐“) (Y : โ„• โ†’ ฮฉ โ†’ ๐“จ) (ฯ‰ : ฮฉ) : โ„• โ†’ ๐“ ร— ๐“จ

Code

def trajectory (A : โ„• โ†’ ฮฉ โ†’ ๐“) (Y : โ„• โ†’ ฮฉ โ†’ ๐“จ) (ฯ‰ : ฮฉ) : โ„• โ†’ ๐“ ร— ๐“จ := fun n โ†ฆ (A n ฯ‰, Y n ฯ‰)
Used by (18)

Actions: Source ยท Open Issue