29
Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout Lyon Neuroscience Research Center, France With many thanks to Jean Daunizeau Guillaume Flandin Karl Friston Will Penny “The true logic for this world is the calculus of Probabilities, which takes account of the magnitude of the probability which is, or ought to be, in a reasonable man's mind.” James Clerk Maxwell (1850)

Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Bayesian Inference

SPM MEEG Course, London, May 2011

Jérémie Mattout Lyon Neuroscience Research Center, France

With many thanks to Jean Daunizeau

Guillaume Flandin Karl Friston Will Penny

“The true logic for this world is the calculus of Probabilities, which takes account of the magnitude of the probability which is, or ought to be, in a reasonable man's mind.” James Clerk Maxwell (1850)

Page 2: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

- General principles - The Bayesian way - SPM examples

Outline

Page 3: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

- General principles - The Bayesian way - SPM examples

Page 4: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Statistics: concerned with the collection, analysis and interpretation of data to make decisions

Applied statistics

Theoretical statistics Descriptive statistics summary statistics, graphics…

Inferential statistics Data interpretations, decision making (Modeling, accounting for randomness and unvertainty, hypothesis testing, infering hidden parameters)

A starting point

Probability

Page 5: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

The notion(s) of probability

B. Pascal (1623-1662)

P. de Fermat (1601-1665)

A.N. Kolmogorov (1903-1987)

Kolomogorov axioms

To express belief that an event has or will occur

(1)

(2)

(3)

10 AP

1P

: All possible events

iA : one particular event

k

i

ik APAAAP1

21 (for mutually exclusive events)

A few consequences…

BAPBPAPBAP (joint probability)

0BAP

BPAPBAP .

(if mutually exclusive events)

(if independent events)

Page 6: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

The notion(s) of probability

Frequentist interpretation Bayesian interpretation

- Probability = frequency of the occurrence of an event, given an infinite number of trials - Is only defined for random processes that can be observed many times - Is meant to be Objective

- Probability = degree of belief, measure of uncertainty - Can be arbitrarily defined for any type of event - Is considered as Subjective in essence

Page 7: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

The notion(s) of probability

Frequentist interpretation Bayesian interpretation

- Probability = frequency of the occurrence of an event, given an infinite number of trials - Is only defined for random processes that can be observed many times - Is meant to be Objective

- Probability = degree of belief, measure of uncertainty - Can be arbitrarily defined for any type of event - Is considered as Subjective in essence

Page 8: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Joint and conditional probabilities

BPBAPBAP ,

BAPBAP ,• Joint probability of A and B

• Conditional probability of A given B BAP

• Note that if A and B are independent

APBAP

and

BPAPBAP ,

Page 9: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

BPBAPBAP ,

BAPBAP ,• Joint probability of A and B

• Conditional probability of A given B BAP

APABPABPBAP ),(,

APABPBPBAP

Joint and conditional probabilities

BP

APABPBAP

T. Bayes (1702-1761)

Page 10: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

)(Xp

Temperature X

22

2

2

1)(

x

exXp

Probability distributions (quick reminder)

Discrete variable (e.g. Binomial distribution)

Continuous variable (e.g. Gaussian distribution)

TailsPHeadsP 1

),(~)( NXp

20

10

)()2010(x

dxxfXpxxn

x ppCxXp 1)1()(

x

xfxXp0

)()(

Number of Heads in 10 trials

Page 11: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

- General principles - The Bayesian way - SPM examples

Page 12: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

A word on generative models

Data generative process ?

Observations (Y) Hidden variables (ϴ)

Model: mathematical formulation of a system or process (set of hypothesis and approximations)

A Probabilistic Model enables to: - Account for prior knowledge and uncertainty (due to randomness, noise, incomplete observations) - Simulate data - Make predictions - Estimate hidden parameters - Test Hypothesis

Page 13: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

To be infered

Model/Hypothesis

Another look at Bayes rule

YP

PYPYP

Likelihood Prior

Marginal likelihood or evidence

Posterior or conditional

Page 14: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

A simple example

YP

PYPYP

Univariate Gaussian variables

Likelihood

Prior

𝑌 = 𝑋𝜃 + 𝜀 ε~𝑁 0, 𝛾

𝜃~𝑁 𝜇, 𝜎

Page 15: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Qualifying priors

YP

PYPYP

Shrinkage prior

𝜃~𝑁 0, 𝜎 with large 𝜎

Conjugate prior

Uninformative (objective) prior

𝜃~𝑁 0, 𝜎

when the prior and posterior distributions belong to the same family

Likelihood dist. Conjugate prior dist.

Beta

Dirichlet

Binomiale

Gaussian

Multinomiale

Gamma

Gaussian

Gamma

Page 16: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Hierarchical models and empirical priors

•••

Likelihood

Prior

𝑌 = 𝑋𝜃1 + 𝜀 ε~𝑁 0, 𝛾

𝜃1~𝑁 𝜃2, 𝜎2

𝜃 = 𝜃1, 𝜃2, . . , 𝜃𝑘−1

𝜃2~𝑁 𝜃3, 𝜎3

•••

𝜃𝑘−1~𝑁 𝜃𝑘 , 𝜎𝑘

𝜃𝑘

Graphical representation

inference

causality

Page 17: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

prior posterior

Univariate Gaussian variables

Hierarchical models and empirical priors

Page 18: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Hypothesis testing

YP

PYPYP

if then accept H0

H

0: 0• given a null hypothesis, e.g.:

• apply decision rule, i.e.:

Posterior Probability Maps (PPM)

YP

YHP 0

YHP 0

0

Page 19: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Comparison with the frequentist approach

if then accept H0

H

0: 0• given a null hypothesis, e.g.:

• apply decision rule, i.e.:

Posterior Probability Map (PPM)

YP

YHP 0

YHP 0

t t Y t *

0*P t t H

0*P t t H if then reject H0

H

0: 0• given a null hypothesis, e.g.:

• apply decision rule, i.e.:

Statistical Parametric Map (SPM)

YtP

Page 20: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Model comparison

YP

PYPYP

MYP

MPMYPMYP

,,

Making the model dependency explicit…

Bayes rule again…

YP

MPMYPYMP

And with no prior in favor of one particular model… MYPYMP

Page 21: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Model comparison

21 MYPMYP if , select model 𝑀1

In practice, compute the Bayes Factor…

2

1

12MYP

MYPBF

B12 Evidence

1 to 3 Weak

3 to 20 Positive

20 to 150 Strong

150 Very strong

… and apply the decision rule

Page 22: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Principle of parsimony

Occam’s razor

Complex models should not be considered without necessity

y=f(

x)

y =

f(x

)

x

MYP

MPMYPMYP

,,

Mo

del

evi

den

ce

Data space

dMpMYpMYp )|(),|()|(

Usually no exact analytic solution !!

Page 23: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Approximations to the (log-)evidence

NnnMYP

MYPBIC log12

,sup

,suplog2

2

1

122,sup

,suplog2

2

1nn

MYP

MYPAIC

Free energy F Obtained from the Variational Bayes inference

Page 24: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Variational Bayes Inference

Variational Bayes (VB) ≡ Expectation Maximization (EM) ≡ Restricted Maximum Likelihood (ReML)

Main features • Iterative optimization procedure • Yields a twofold inference on parameters 𝜃 and models 𝑀 • Uses a fixed-form approximate posterior 𝑞 𝜃 • Make use of approximations (e.g. mean field, Laplace) to approach 𝑃 𝜃 𝑌, 𝑀 and 𝑃 𝑌 𝑀

The criterion to be maximized is the (negative) free-energy F

𝑭 = ln 𝑃 𝑌 𝑀 − 𝐷𝐾𝐿 𝑄 𝜃 ; 𝑃 𝜃 𝑌, 𝑀 = ln 𝑃 𝑌, 𝜃 𝑀 𝑄 + 𝑆 𝑄

= ln 𝑃 𝑌 𝜃, 𝑀 𝑄 − 𝐷𝐾𝐿 𝑄 𝜃 ; 𝑃 𝜃 𝑀

F is a lower bound to the log-evidence

F = accuracy - complexity

Page 25: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

To summarize Bayesian inference enables us to

• Make use of probabilities to formalize complex models, to incorporate prior knowledge and to deal with randomness, uncertainty or incomplete observations • Test hypothesis on both parameters and models • Formalize the scientific methods, that is up-dating our knowledge by testing hypothesis

YP

PYPYP

Likelihood A Priori

Marginal likelihood or evidence

A Posteriori

Model

Inference

Page 26: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

- General principles - The Bayesian way - SPM examples

Page 27: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

grey matter CSF white matter

yi ci

k

2

1

1 2 k

class variances

class

means

ith voxel

value

ith voxel

label

class

frequencies

Segmentation of anatomical MRI

Page 28: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

EEG/MEG source reconstruction

Page 29: Bayesian Inference - FIL · Bayesian Inference SPM MEEG Course, London, May 2011 Jérémie Mattout ... - General principles - The Bayesian way - SPM examples Outline -General principles

Evidence for feedback loops (MMN paradigm)

Devient condition

Dynamic causal modelling of EEG data