- 68 Views
- Uploaded on
- Presentation posted in: General

Stochastic approximate inference

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Stochastic approximate inference

Kay H. Brodersen

Computational Neuroeconomics GroupDepartment of EconomicsUniversity of Zurich

Machine Learning and Pattern Recognition GroupDepartment of Computer ScienceETH Zurich

http://people.inf.ethz.ch/bkay/

sample from an arbitrary distribution

compute an expectation

compute an expectation

compute an expectation

How to evaluate the posterior distribution of the model parameters?

How to compute the evidence term?

How to compute the expectation of the posterior?

How to make a point prediction?

Stochastic approximationsthrough sampling

- computationally expensive
- storage intensive
- asymptotically exact
- easily applicable general-purpose algorithms

Deterministic approximationsthrough structural assumptions

- application often requires mathematical derivations (hard work)
- systematic error
- computationally efficient
- efficient representation
- learning rules may give additional insight

Sampling from a desired target distributionwe need to find a way of drawing random numbers from some target distribution

Computing an expectation w.r.t. that target distribution

we can approximate the expectation of using the sample mean:

sampling

z

summary

z

1

transformation

Idea: we can obtain samples from some distribution by first sampling from the uniform distribution and then transforming these samples.

- Algorithm for sampling from
- Draw a random number from the uniform distribution:
- Transform by applying the inverse cumulative density function (cdf) of the desired target distribution:
- Repeat both steps for .

- Example: sampling from the exponential distribution
- The desired pdf is:
- The corresponding cdf is:
- The inverse cdf is:
- Thus, is a sample from the exponential distribution.

- Implementation in MATLAB
for t=1:10000

z(t) = -1/lambda*log(1-rand);

end

hist(z)

mean(z)

- Discussion
- yields high-quality samples
- easy to implement
- computationally efficient
- obtaining the inverse cdf can be difficult

2

The proposal distribution , scaled by a factor , represents an envelope of .

Idea: when the transformation method cannot be applied, we can resort to a more general method called rejection sampling. Here, we draw random numbers from a simpler proposal distribution and keep only some of these samples.

- Algorithm for sampling from
- Sample from
- Sample from
- If , then accept the sample:
- Otherwise, discard and .
- Repeat until we have obtained accepted samples.

- Idea: if our goal is to compute the expectation , we can outperform rejection sampling by bypassing the generationg of random samples.
- NaÃ¯ve approach
- A naÃ¯ve approach would be to approximate the expectation as follows. Rather than sampling from , we discretize -space into a uniform grid and evaluate:
- There are two problems with this approach:
- The number of terms in the summation grows exponentially with the dimensionality of .
- Only a small proportion of the samples will make a significant contribution to the sum. Uniform sampling clearly is very inefficient.

Addressing the two problems of the naive approach above, given a proposal distribution , we can approximate the expectation aswhere the samples are drawn from .

The quantities are known as importance weights, and they correct the bias introduced by sampling from the wrong distribution.

Unlike in the case of rejection sampling, all of the generated samples are retained.

3

Idea: we can sample from a large class of distributions and overcome the problems that previous methods face in high dimensions using a framework called Markov Chain Monte Carlo.

- A first-order Markov chain is defined as a series of random variables such the following conditional-independence property holds:
- Thus, the graphical model of a Markov chain is a chain:
- A Markov chain is specified in terms of
- the initial probability distribution
- the transition probabilities

Markov chain: state diagram

Equlibrium distribution

2

0.5

1

0.5

0.5

3

1

2

3

Markov chain: state diagram

Equlibrium distribution

2

1

3

1

2

3

Desired target distribution

Empirical distribution of samples

z

z

Markov chain whose equilibrium distribution is

1

3

5

7

2

4

6

8

- Algorithm for sampling from
- Initialize by drawing somehow.
- At cycle , draw a candidate sample from .Importantly, needs to be symmetric, i.e., .
- Accept with probability,and otherwise set .

- Notes
- In contrast to rejection sampling, each cycle leads to a new sample, even when the candidate is discarded.
- Note that the sequence is not a set of independent samples from because successive samples are highly correlated.

- Algorithm for sampling from
- Initialize by drawing somehow.
- At cycle , draw a candidate sample from .In contrast to the Metropolis algorithm (see previous slide), no longer needs to be symmetric.
- Accept with probability,and otherwise set .

p(z*)

Inrease in density:

p(zÏ„)

zÏ„

z*

p(zÏ„)

Decreasein density:

p(z*)

zÏ„

z*

Idea: as an alternative to the Metropolis-Hastings algorithm, Gibbs sampling is less broadly applicable but does away with acceptance tests and can therefore be more efficient.

Suppose we wish to sample from a multivariate distribution , e.g., representing several variables in a model. For example, we might be interested in their joint posterior distribution.

In Gibbs sampling, we update one component at a time.

- Algorithm for sampling from
- Initialize somehow.
- At cycle , sample , i.e., replace the variable by a new sample, drawn from a distribution that is conditioned of the current values of all other variables. The resulting new vector is our new sample.
- In the next cycle, replace a different variable . The simplest procedure is to go round Alternatively, could be chosen randomly.

- Throughout Bayesian statistics, we encounter intractable problems. Most of these problems are: (i) evaluating a distribution; or (ii) computing the expectation of a distribution.
- Sampling methods provide a stochastic alternative to deterministic methods. They are usually computationally less efficient, but are asymptotically correct, broadly applicable, and easy to implement.
- We looked at three main approaches:
- Transformation method: efficient sampling from simple distributions
- Rejection sampling and importance sampling: sampling from arbitrary distributions; direct computation of an expected value
- Monte Carlo Markov Chain (MCMC): efficient sampling from high-dimensional distributions through the Metropolis-Hastings algorithm or Gibbs sampling

Supplementary slides

- Procedure:
- Proof:. Is ?Moreover: Therefore:

Ergodicity: A Markov chain is ergodic if the distribution converges to an invariant distribution irrespective of the choice of initial distribution . A homogeneous Markov chain will be ergodic, subject to some weak restrictions on the invariant distribution and the transition probabilities.

Equilibrium distribution: Given an ergodic Markov chain, that invariant distribution which any initial distribution converges to is called the equilibrium distribution. (An ergodic Markov chain may have several invariant distributions but only one of these is the equilibrium distribution.)