CS 4110 Probabilistic Programming Probabilistic Programming It's - - PowerPoint PPT Presentation

cs 4110
SMART_READER_LITE
LIVE PREVIEW

CS 4110 Probabilistic Programming Probabilistic Programming It's - - PowerPoint PPT Presentation

CS 4110 Probabilistic Programming Probabilistic Programming It's not about writing software. Probabilistic Programming Probabilistic programming is a tool for statistical modeling. OR A probabilistic programming language is a plain old


slide-1
SLIDE 1

CS 4110

Probabilistic Programming

slide-2
SLIDE 2

Probabilistic Programming

It's not about writing software.

slide-3
SLIDE 3

Probabilistic Programming

Probabilistic programming is a tool for statistical modeling. OR A probabilistic programming language is a plain old programming language with rand(3) and a suite of fancy analysis tools for understanding its probabilistic behavior.

slide-4
SLIDE 4

An Example Model

PL+stats PL stats

Takes CS 4242 Takes CS 4110 Takes CS 4780 Paper 2 Relevant Paper 3 Relevant Paper 1 Relevant Cloud of Unknowing

slide-5
SLIDE 5

A Model for Humans

Interest in PL Interest in Stats Takes CS 4242 Takes CS 4110 Takes CS 4780

slide-6
SLIDE 6

A Model for Humans

Interest in PL Interest in Stats Takes CS 4242 Takes CS 4110 Takes CS 4780 Busy?

slide-7
SLIDE 7

A Model for Humans

Interest in PL Interest in Stats Takes CS 4242 Takes CS 4110 Takes CS 4780 Busy? Interest in PL Interest in Stats Paper 2 Relevant Paper 3 Relevant Paper 1 Relevant

slide-8
SLIDE 8

A Model for Humans

Pr[ANIPS|Istats ∧ B] = 0.3 Pr[ANIPS|Istats ∧ ¬B] = 0.8 Pr[ANIPS|¬Istats] = 0.1 Pr[ADagstuhl|Istats ∧ IPL] = 0.3 Pr[ADagstuhl|Istats ∧ IPL ∧ ¬B] = 0.8 Pr[ADagstuhl|¬(Istats ∨ IPL)] = 0.1 R1 ∼ IPL ∧ Istats R3 ∼ Istats R2 ∼ IPL

… …

Whither reuse? Whither abstraction? Whither intermediate variables?

slide-9
SLIDE 9

Writing even this tiny model feels like drudgery.

(and we haven’t even gotten to the hard part yet)

slide-10
SLIDE 10
  • What and Why
  • The Basics and Examples
  • Applications
  • Current Problems
slide-11
SLIDE 11

webppl.org

slide-12
SLIDE 12

Our First Probabilistic Program

var b = flip(0.5); b ? "yes" : "no"

slide-13
SLIDE 13

Enumeration

var roll = function () { var die1 = randomInteger(6) + 1; var die2 = randomInteger(6) + 1; return die1 + die2; } Enumerate(roll)

slide-14
SLIDE 14

Our Basic Model in webppl

slide-15
SLIDE 15

Conditioning

var roll = function () { var die1 = randomInteger(6) + 1; var die2 = randomInteger(6) + 1; if (!(die1 === 4 || die2 === 4)) { factor(-Infinity); } return die1 + die2; } Enumerate(roll)

slide-16
SLIDE 16

Conditioning

  • n Observations

// Discard any executions that // don’t sum to 10. var out = die1 + die2; if (out !== 10) { factor(-Infinity); } // Return the values on the dice. return [die1, die2];

slide-17
SLIDE 17

Recommending Papers

// Require my class attendance. var att = attendance(i_pl, i_stats, busy); require(att.cs4110 && att.cs4242 && !att.cs4780); return relevance(i_pl, i_stats);

slide-18
SLIDE 18

Inference Algorithms

Enumerate is the simplest possible inference strategy.

slide-19
SLIDE 19
  • What and Why
  • The Basics and Examples
  • Applications
  • Current Problems
slide-20
SLIDE 20

TrueSkill

// prior distributions, the hypothesis

let skill() = random (Gaussian(10.0,20.0)) let Alice,Bob,Cyd = skill(),skill(),skill()

// observe the evidence

let performance player = random (Gaussian(player,1.0))

  • bserve (performance Alice > performance Bob) //Alice beats Bob
  • bserve (performance Bob > performance Cyd) //Bob beats Cyd
  • bserve (performance Alice > performance Cyd) //Alice beats Cyd

// return the skills Alice,Bob,Cyd

Measure Transformer Semantics for Bayesian Machine Learning

Johannes Borgstr¨

  • m

Andrew D. Gordon Michael Greenberg James Margetson Jurgen Van Gael

slide-21
SLIDE 21

webppl Vision Demo

slide-22
SLIDE 22

Forestdb.org

slide-23
SLIDE 23
  • What and Why
  • The Basics and Examples
  • Applications
  • Current Research
slide-24
SLIDE 24

R2

slide-25
SLIDE 25

R2’s weakest preconditions

var die1 = randomInteger(7) + 1; var die2 = randomInteger(7) + 1; // Discard any executions that // don’t sum to 10. var out = die1 + die2; require(out === 10);

wasted work!

slide-26
SLIDE 26

R2’s weakest preconditions

var die1 = randomInteger(7) + 1; var die2 = randomInteger(7) + 1; require( (die1 == 3 && die2 == 7) || …); var out = die1 + die2; require(out === 10);

slide-27
SLIDE 27

R2’s weakest preconditions

var die1 = randomInteger(7) + 1; var die2 = randomInteger(7) + 1; require( (die1 == 3 && die2 == 7) || …); var out = die1 + die2;

slide-28
SLIDE 28

Probabilistic assertions: design goals

Work on a messy, mainstream language (C and C++) Efficiently check statistical properties of the output We don’t care about conditioning

slide-29
SLIDE 29

assert e p

, p, c

e must hold with probability p at confidence c

slide-30
SLIDE 30

passert e, p, c

float obfuscated(float n) { return n + gaussian(0.0, 1000.0); } float average_salary(float* salaries) { total = 0.0; for (int i = 0; i < COUNT; ++i) total += obfuscated(salaries[i]); avg = total / len(salaries); p_avg = ...; }

Bayesian network IR

distribution extraction

via symbolic execution statistical

  • ptimizations

verification

slide-31
SLIDE 31

Bayesian network IR

distribution extraction

via symbolic execution statistical

  • ptimizations

verification

passert e, p, c

float obfuscated(float n) { return n + gaussian(0.0, 1000.0); } float average_salary(float* salaries) { total = 0.0; for (int i = 0; i < COUNT; ++i) total += obfuscated(salaries[i]); avg = total / len(salaries); p_avg = ...; }

slide-32
SLIDE 32

Distribution extraction: random draws are symbolic

b = a + gaussian(0.0, 1.0)

a 4.2

symbolic heap

a 4.2 b

G0,1

4.2 +

slide-33
SLIDE 33

input: a = 4.2 b = gaussian(0.0, 1.0)

a

4.2

b

G0,1

slide-34
SLIDE 34

input: a = 4.2 b = gaussian(0.0, 1.0) c = a + b

a

4.2

b

G0,1

c

+

slide-35
SLIDE 35

input: a = 4.2 b = gaussian(0.0, 1.0) c = a + b d = c + b

a

4.2

b

G0,1

c

+

d

+

slide-36
SLIDE 36

input: a = 4.2 b = gaussian(0.0, 1.0) c = a + b d = c + b

a

4.2

b

G0,1

c

+

d

+

slide-37
SLIDE 37

input: a = 4.2 b = gaussian(0.0, 1.0) c = a + b d = c + b if b > 0.5 e = 2.0 else e = 4.0

a

4.2 G0,1

c

+

d

+ ?

e

if

2.0 4.0

then else

b

> 0.5

slide-38
SLIDE 38

input: a = 4.2 b = gaussian(0.0, 1.0) c = a + b d = c + b if b > 0.5 e = 2.0 else e = 4.0 passert e <= 3.0, 0.9, 0.9

a

4.2 G0,1

c

+

d

+ ?

e

if

2.0 4.0

then else

b

> 0.5 ≤ 3.0

slide-39
SLIDE 39

passert e, p, c

float obfuscated(float n) { return n + gaussian(0.0, 1000.0); } float average_salary(float* salaries) { total = 0.0; for (int i = 0; i < COUNT; ++i) total += obfuscated(salaries[i]); avg = total / len(salaries); p_avg = ...; }

Bayesian network IR

distribution extraction

via symbolic execution statistical

  • ptimizations

verification

slide-40
SLIDE 40

statistical property passert verifier

  • ptimization

X ∼ G ( µX , σ2

X)

Y ∼ G ( µY , σ2

Y )

Z = X + Y ⇒ Z ∼ G ( µX + µY , σ2

X + σ2 Y )

X ∼ U(a, b) Y = cX ⇒ Y ∼ U(ca, cb) X ∼ U(a, b) Y ∼ X ≤ c a ≤ c ≤ b ⇒ Y ∼ B ✓c − a b − a ◆

X

1

, X

2

, . . . , X

n

∼ D Y = X

i

X

i

⇒ Y ∼ G ( n µ

D

, n σ

2 D

)

slide-41
SLIDE 41

passert e, p, c

float obfuscated(float n) { return n + gaussian(0.0, 1000.0); } float average_salary(float* salaries) { total = 0.0; for (int i = 0; i < COUNT; ++i) total += obfuscated(salaries[i]); avg = total / len(salaries); p_avg = ...; }

Bayesian network IR

distribution extraction

via symbolic execution statistical

  • ptimizations

verification