Advanced Simulation - Lecture 10 Patrick Rebeschini February 14th, - - PowerPoint PPT Presentation

advanced simulation lecture 10
SMART_READER_LITE
LIVE PREVIEW

Advanced Simulation - Lecture 10 Patrick Rebeschini February 14th, - - PowerPoint PPT Presentation

Advanced Simulation - Lecture 10 Patrick Rebeschini February 14th, 2018 Patrick Rebeschini Lecture 10 1/ 30 Outline Often we have various possible models for the same dataset. Sometimes theres an infinity of possible models! How to


slide-1
SLIDE 1

Advanced Simulation - Lecture 10

Patrick Rebeschini February 14th, 2018

Patrick Rebeschini Lecture 10 1/ 30

slide-2
SLIDE 2

Outline

Often we have various possible models for the same dataset. Sometimes there’s an infinity of possible models! How to choose between models? Green (1995), Reversible Jump Markov chain Monte Carlo and Bayesian model determination.

Patrick Rebeschini Lecture 10 2/ 30

slide-3
SLIDE 3

Motivation: Bayesian model choice

Assume we have a collection of models Mk for k ∈ K. With data we can learn parameters given each model Mk, but we can also learn about the models. Put a prior on models Mk. Within each model, prior p(θk | Mk) on the parameters. Joint posterior distribution of interest: π(Mk, θk | y) = π(Mk | y)π(θk | y, Mk) which is defined on ∪k∈K{Mk} × Θk ≡ ∪k∈K{k} × Θk.

Patrick Rebeschini Lecture 10 3/ 30

slide-4
SLIDE 4

Polynomial regression

Data (xi, yi)n

i=1 where (xi, yi) ∈ R × R.

Polynomial regression model Mk : y =

k

  • j=0

βjxj

  • =f(x;β)

+ ε, ε ∼ N

  • 0, σ2

. If k is too large then f

  • x;

β

  • =

k

  • j=0
  • βjxj

where β =

  • β0,

β1, ..., βk

  • is the MLE, will overfit.

Patrick Rebeschini Lecture 10 4/ 30

slide-5
SLIDE 5

Polynomial regression

5 10 −20 20 40

M = 0

5 10 −20 20 40

M = 1

5 10 −20 20 40

M = 2

5 10 −20 20 40

M = 3

5 10 −20 20 40

M = 4

5 10 −20 20 40

M = 5

5 10 −20 20 40

M = 6

5 10 −20 20 40

M = 7

Figure: As order of the model M = k increases, we overfit.

Patrick Rebeschini Lecture 10 5/ 30

slide-6
SLIDE 6

Bayesian polynomial regression

We select k ∈ {0, ..., Mmax} and P (Mk) = pk = 1 Mmax + 1 with Θk = Rk+1 × R+ pk

  • β, σ2

= N

  • β; 0, σ2Ik+1
  • IG
  • σ2; 1, 1
  • .

In this case, we have analytic expression for pk (y1:n) =

  • Θk

pk

  • β, σ2 n
  • i=1

N

  • yi; f (xi; β) , σ2

dβdσ2. Bayesian model selection automatically prevents overfitting.

Patrick Rebeschini Lecture 10 6/ 30

slide-7
SLIDE 7

Bayesian Polynomial regression

5 10 −20 20 40

M = 0

5 10 −20 20 40

M = 1

5 10 −20 20 40

M = 2

5 10 −20 20 40

M = 3

5 10 −20 20 40

M = 4

5 10 −20 20 40

M = 5

5 10 −20 20 40

M = 6

5 10 −20 20 40

M = 7

1 2 3 4 5 6 7 0.2 0.4 0.6 0.8 1

M P(Y|M) Model Evidence

Figure: f (x; β) for random draws from pM (β| y1:n) and evidence pM (y1:n).

Patrick Rebeschini Lecture 10 7/ 30

slide-8
SLIDE 8

Motivation: mixture models

Assume the observations Y1, . . . , Yn come from

K

  • k=1

pkN(µk, σ2

k)

with K

k=1 pk = 1. For any fixed K, the parameters to infer

are (p1, . . . , pK−1, µ1, . . . , µK, σ2

1, . . . , σ2 K) of dimension

3K − 1. But what about inference on K? We can put a prior on K, e.g. a Poisson distribution. How do we get the posterior?

Patrick Rebeschini Lecture 10 8/ 30

slide-9
SLIDE 9

Sampling in transdimensional spaces

Consider a collection of models Mk, for k ∈ K ⊂ N. We want to design a Markov chain taking values in ∪k∈K{k} × Θk, with the correct joint posterior. Reversible jump MCMC is a generalized Metropolis-Hastings using a mixture of kernels. For each k, standard MH kernel from {k} × Θk to {k} × Θk, i.e. standard within-model moves. How to move from {k} × Θk to {k′} × Θk′?

Patrick Rebeschini Lecture 10 9/ 30

slide-10
SLIDE 10

Transdimensional moves

We can propose k′ from q(k′ | k). Then we need to propose a move from Θk to Θk′, of dimension dk and dk′. dimension matching: extend the spaces with auxiliary variables. Introduce uk→k′ and uk′→k with distributions ϕk→k′ and ϕk′→k respectively, and such that dk + dim(uk→k′) = dk′ + dim(uk′→k).

Patrick Rebeschini Lecture 10 10/ 30

slide-11
SLIDE 11

Transdimensional moves

Given θk, we sample uk→k′ ∼ ϕk→k′ and then apply a deterministic mapping to get (θk′, uk′→k) = Gk→k′(θk, uk→k′). The distributions ϕ are arbitrary and Gk→k′ has to be a diffeomorphism. We now have our proposal from Θk to Θk′. With what probability do we accept it?

Patrick Rebeschini Lecture 10 11/ 30

slide-12
SLIDE 12

Transdimensional moves

Mimicking Metropolis-Hastings, given x we propose a point x′ and accept or not with probability α(x → x′). We want P to be such that, for all A, B:

  • x,x′∈A×B

π(dx)P(x → dx′) =

  • x,x′∈A×B

π(dx′)P(x′ → dx)

  • r equivalently
  • x,x′∈A×B

π(dx)q(x → dx′)α(x → x′) =

  • x,x′∈A×B

π(dx′)q(x′ → dx)α(x′ → x)

Patrick Rebeschini Lecture 10 12/ 30

slide-13
SLIDE 13

Transdimensional moves

Subtle point: π(dx)P(x, dx′) does not necessarily admit a density with respect to a standard measure. We cannot write e.g. π(x)P(x, dx′) = π(x)P(x, x′)dxdx′ However π(dx)q(x, dx′) can be assumed to be dominated and we write π(x)q(x, dx′) = π(x)q(x, x′)dxdx′

Patrick Rebeschini Lecture 10 13/ 30

slide-14
SLIDE 14

Transdimensional moves

First term is:

  • x,x′∈A×B

π(x)q(x → x′)α(x → x′)dxdx′ Suppose we propose x′ by sampling u ∼ ϕ and then taking (x′, u′) = G(x, u) deterministically. We write x′(x, u) and u′(x, u). The expression becomes

  • x,x′(x,u)∈A×B

π(x)ϕ(u)α(x → x′(x, u))dxdu What is the reverse transition from x′ to x? Sample u′ ∼ ϕ′ and take (x, u) = G−1(x′, u′).

Patrick Rebeschini Lecture 10 14/ 30

slide-15
SLIDE 15

Transdimensional moves

Second term was:

  • x,x′∈A×B

π(x′)q(x′ → x)α(x′ → x)dxdx′ It becomes, with (x, u) = G−1(x′, u′):

  • x(x′,u′),x′∈A×B

π(x′)ϕ′(u′)α(x′ → x(x′, u′))dx′du′ Let us do a change of variable to get an integral with respect to dxdu instead of dx′du′:

  • ·

π(x′(x, u))ϕ′(u′(x, u))α(x′(x, u) → x)

  • ∂G(x, u)

∂(x, u)

  • dxdu

Patrick Rebeschini Lecture 10 15/ 30

slide-16
SLIDE 16

Transdimensional moves

We see that the integrals are equal if π(x)ϕ(u)α(x → x′(x, u)) = π(x′(x, u))ϕ′(u′(x, u))α(x′(x, u) → x)

  • ∂G(x, u)

∂(x, u)

  • Thus we can see a valid choice of α(x → x′) in :

α(x → x′) = min

  • 1, π(x′)ϕ′(u′)

π(x)ϕ(u)

  • ∂G(x, u)

∂(x, u)

  • Patrick Rebeschini

Lecture 10 16/ 30

slide-17
SLIDE 17

Transdimensional moves

We can now answer the initial question: How to move from {k} × Θk to some other {k′} × Θk′? We start from some (k, θk). Sample k′ ∼ q(k → k′), then sample uk→k′ from ϕk→k′. Compute deterministically (θk′, uk′→k) = Gk→k′(θk, uk→k′). Compute αk→k′ = min

  • 1, π(θk′)ϕk′→k(uk′→k)

π(θk)ϕk→k′(uk→k′) q(k′ → k) q(k → k′)Jk→k′(θk, uk→k′)

  • where

Jk→k′(θk, uk→k′) =

  • ∂Gk→k′(θk, uk→k′)

∂(θk, uk→k′)

  • .

Patrick Rebeschini Lecture 10 17/ 30

slide-18
SLIDE 18

Reversible Jump algorithm

Starting with

  • k(0), θ(0)

iterate for t = 1, 2, 3, ... With probability β, set k(t) = k(t−1) and do one step of Kk(t) leaving π(θk(t) | y, Mk(t)) invariant. With probability 1 − β, propose k′ ∼ q(k′ | k(t−1)). Draw a random variable uk(t−1)→k′ ∼ ϕk(t−1)→k′. Apply the deterministic mapping Gk(t−1)→k′ to get θ′, u′. With “between-models” acceptance probability a(θ(t−1) → θ′): accept, i.e. set θ(t) = θ′, k(t) = k′,

  • therwise reject, i.e. set θ(t) = θ(t−1), k(t) = k(t−1).

Patrick Rebeschini Lecture 10 18/ 30

slide-19
SLIDE 19

Toy example

Two models, uniform prior on models p(M1) = p(M2) = 1

2.

In model M1, θ ∈ R and we can evaluate pointwise posterior1(θ) ∝ p(θ | M1)L(θ | M1) = exp

  • −1

2 (θ)2

  • In model M2, θ ∈ R2 and we can evaluate pointwise

posterior2(θ) ∝ p(θ | M2)L(θ | M2) = exp

  • −1

2 (θ1)2 − 1 2 (θ2)2

  • Patrick Rebeschini

Lecture 10 19/ 30

slide-20
SLIDE 20

Toy situation

In terms of model comparison, we should find p(M2 | y) p(M1 | y) = p(y | M2)p(M2) p(y | M1)p(M1) =

  • R2 p(θ | M2)L(θ | M2)dθ
  • R p(θ | M1)L(θ | M1)dθ ×

1 2 1 2

= 2π √ 2π = √ 2π ≈ 2.5066 In terms of parameters, in model M1, θ ∼ N(0, 1) and in model M2, θ ∼ N

  • ,
  • 1

1

  • .

Patrick Rebeschini Lecture 10 20/ 30

slide-21
SLIDE 21

Reversible Jump algorithm

We need to construct various Markov kernels. A Markov kernel “within Mk” for each model Mk. Toy example: introduce a Metropolis Hastings with random walk proposal, of variance σ2 for model M1 and Σ for model M2. A Markov kernel to move between models, i.e. for each pair k, proposing k′ and proposing to move parameters of Mk to parameters of Mk′. Toy example: introduce K12 moving a parameter θ ∈ R to a parameter (θ1, θ2) ∈ R2, and introduce K21 moving a parameter (θ1, θ2) ∈ R2 to a parameter θ ∈ R.

Patrick Rebeschini Lecture 10 21/ 30

slide-22
SLIDE 22

Toy example

For K12 do the following. Sample u from C(0, 1), a standard Cauchy (dimension matching). Map deterministically (θ1, θ2) = G1→2(θ, u) = (θ, u), with Jacobian equal to 1. Compute α1→2 = min

  • 1, exp(−0.5θ2 − 0.5u2)

exp(−0.5θ2)C(u; 0, 1)

  • Indeed the Jacobian is equal to 1, the priors on M1 and

M2 are identical, and q(k′ | k) = q(k | k′). Accept θ1, θ2 or stay at θ.

Patrick Rebeschini Lecture 10 22/ 30

slide-23
SLIDE 23

Toy example

For K21 do the following. Map deterministically (θ, u) = G2→1(θ1, θ2) = (θ1, θ2), with Jacobian equal to 1. Compute α2→1 = min

  • 1, exp(−0.5θ2

1)C(θ2; 0, 1)

exp(−0.5θ2

1 − 0.5θ2 2)

  • Indeed the Jacobian is equal to 1, the priors on M1 and

M2 are identical, and q(k′ | k) = q(k | k′). Accept θ or stay at (θ1, θ2).

Patrick Rebeschini Lecture 10 23/ 30

slide-24
SLIDE 24

Reversible Jump algorithm

Introduce a probability of performing a “between-model” move at each step, say β ∈ [0, 1]. Given the current state of the chain kt, θt at time t:

  • with probability β, between-model move: draw

(kt+1, θt+1) by drawing k′ ∼ q(k′ | k), dimension matching, deterministic mapping, RJ acceptance ratio. . .

  • with probability 1 − β, within-model move: standard

Metropolis-Hastings in the current model.

Patrick Rebeschini Lecture 10 24/ 30

slide-25
SLIDE 25

Results

0.0 0.1 0.2 0.3 0.4 −2 2

θ density

Figure: Parameter θ in model M1.

Patrick Rebeschini Lecture 10 25/ 30

slide-26
SLIDE 26

Results

0.0 0.1 0.2 0.3 0.4 −2 2

θ1 density

0.0 0.1 0.2 0.3 0.4 −2 2

θ2 density

Figure: Parameter (θ1, θ2) in model M2.

Patrick Rebeschini Lecture 10 26/ 30

slide-27
SLIDE 27

Results

1 2 2500 5000 7500 10000

iteration k

Figure: Model index k along iterations. Probability of accepting model jumps: ≈ 43.6%. The number of visits in M2 divided by the number of visits in M1 equals ≈ 2.39, approximating the Bayes factor

  • f ≈ 2.51.

Patrick Rebeschini Lecture 10 27/ 30

slide-28
SLIDE 28

Results

If instead of C(0, 1) we use N(3, 1) for the dimension matching variable.

1 2 2500 5000 7500 10000

iteration k

Figure: Model index k along iterations. Probability of accepting model jumps: ≈ 12.2%. Bayes factor approximated by ≈ 2.21.

Patrick Rebeschini Lecture 10 28/ 30

slide-29
SLIDE 29

Results

If instead of C(0, 1) we use N(5, 1) for the dimension matching variable.

1 2 2500 5000 7500 10000

iteration k

Figure: Model index k along iterations. Probability of accepting model jumps: ≈ 1.43%. Bayes factor approximated by ≈ 2.31 (not so bad!).

Patrick Rebeschini Lecture 10 29/ 30

slide-30
SLIDE 30

Reversible Jump algorithm: conclusion

Probably the most ambitious MCMC algorithm, aiming at parameter estimation and model choice in one run. In general it’s hard to design auxiliary variables for dimension matching and deterministic mappings such that the acceptance rate of between-model moves is decent. Transdimensional samplers constitute an on-going research area, see for instance: Annealed Importance Sampling Reversible Jump MCMC Algorithms, by Karagiannis and Andrieu, 2013.

Patrick Rebeschini Lecture 10 30/ 30