Importance Sampling-Stochastic Process-Lecture Slides, Slides of Stochastic Processes

Main topics for this course are Stochastic process, random variables, linear congruent generators, pdfs and cdfs, rejection method, metropolis methods, sampling techniques, random walks and genetic algorithm. This lecture includes: Importance, Sampling, Direct, Method, Integrals, Variables, Probability, Distribution, Function, Arithmetic, Mean, Error, Variance, Lagrange

Typology: Slides

2011/2012

Uploaded on 08/12/2012

ranganath
ranganath 🇮🇳

4.7

(3)

37 documents

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
2
Lecture: Importance Sampling
Monte Carlo Methods
Monte Carlo Methods
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Importance Sampling-Stochastic Process-Lecture Slides and more Slides Stochastic Processes in PDF only on Docsity!

Lecture: Importance Sampling

Monte Carlo Methods

Monte Carlo Methods

docsity.com

If the integral has the following form:

The Direct Method for Integrals Then the following game of chance may be used to make numericalestimates. We draw a set of variables from f(X), as

Where,

dX

X

f

X

g

G

∫ Ω

dX

X

f

X

f

N

X

X

X

X

3

2

1

L

That is we sample the probability distribution function f(X) as doneearlier. Then we form the arithmetic mean as value of integral:

i

i

N

X

g

N
G

docsity.com

There are three major classes of techniques that are used to reduce the variance in Monte Carlo calculations. 1.

Importance Sampling can be used to increases the likelihood ofsampling variable where the function is large or rapidly varying.

The expected value of the random variable can be used ratherthan the variable itself.

Correlations between succeeding samples may be exploited tothe advantage.

In control variates, an easily evaluated approximation to theintegrand is used to reduce the variance.

How to Reduce Variance

IMPORTANCE SAMPLING may be the answer to this all !!!

docsity.com

Importance Sampling

Suppose we have an n-dimensional integral:

=

dX

X

f

X

g

G

)

(

)

(

And we wish to evaluate it. The function f(X) is not necessarily thebest pdf to be used in Monte Carlo calculation even though it is inthe integrand. A different pdf, h(X) can be introduced as following:

Where,

⎤ ⎥ ⎦

⎡ ⎢ ⎣

=

dX

X

h

X

h

X

f

X

g

G

)

(

)

(

)

(

)

(

=

, 1 ) ( , 0 ) (

dX

X

h

X

h

and

<

)

(

)

(

)

(

X

h

X

f

X

g

docsity.com

A Monte Carlo method to evaluate the integral would be to sample a series of X values from h(X) and then construct the following sum:

=

=

N

i

i

i

i

N

X

h

X f X g N G

1

)

(

) ( ) ( 1 ~

This clearly corresponds to the minimum variance calculation. As a first example, let us consider one integral to be estimated.

Importance Sampling

docsity.com

let us consider the integral:

(

)

dx

x

G

1 0

cos

A straightforward Monte Carlo algorithm is to sample x uniformly on[0, 1] and sum the quantity cos(

π

x/2).

Then variance can be estimated and its value is about 0.0947. Let us expand cosine in power series.

L

cos(

4

4

4

2

2

x

x

x

Example 1: Importance Sampling

docsity.com

%

Sampling from a Function g(x) = cos(pi*x/2) and

%

find area under f(x)g(x), where,

%

f(x) = 3(1 – xx* ) in interval [0, 1]

const = pi/2; c1 = 1./const; x(1)=0; N(1) = 1000; exact(1)= c1; area(1)=c1;

nbins = 10; nmax = 40;

for jj=1: nmax %%% loop for change in N

rand('state', 0) % initialize

jj N(jj+1) = N(jj) + 1000;

sum1 = 0.0; sum2 = 0.0;

for i=1:nbins %----------------------------- loop begins for nbins

rand('state', i) % initialize icount = 0; sum = 0.0;

for k = 1:N(jj+1) % ------------------- loop for integration

x = rand;

% g = cos(const*x);

% simple way

% sum = sum + g;

% simple way

%

icount = N(jj+1);

% simple way

gg = 2cos(constx)/(3(1-xx));

%importance sampling

if(y <=(1-x^2)) sum = sum + gg;

%importance sampling

icount = icount + 1; end

%importance sampling

end

area(i) = sum/icount; sum1 = sum1 + area(i); sum2 = sum2 + area(i)^2;

end %---------------------------------- loop ends for nbins

avarea(jj+1) = sum1/10.0 ; ava2 = sum2/10.0; var = ava2 - avarea(jj+1)^2; stdev(jj+1) = sqrt(var) ;

exact(jj+1) = c1;

axis([1 50000 0.63 0.65])

errorbar(N,avarea,stdev) plot(N, exact, 'r:.') hold on m(jj)= getframe;

end %%% loop for change in N

MATLAB Program for

Importance

Sampling

Example 1:

docsity.com

12

0

10000

20000

30000

0.644 0.642 0.640 0.638 0.636 0.

Average Area

N

Simple

MC

0

10000

20000

30000

40000

0.6440.6420.6400.6380.6360.

Average Area

N

Using Importance Sampling

Results

Example 1:

docsity.com

Another example on importance sampling:

The variance associated with this procedure is

Again a straightforward Monte Carlo method would be to sample xuniformly on (0, 1) and form the estimator:

dx

x

G

1 0

2

2

1

1

x

g

=

050

.

0

}

var{

1

=

g

To improve the calculations and reduce the variance, the integrandcan be expanded in a power series about its maximum:

L

=

2

2 1

1

x

g

Example 2 Find this integral:

: Importance Sampling

docsity.com

From this we infer that a reasonable importance function might be following:

2

x
x
h

The value of b might be chosen to give the minimum variance.

With this choice of h(x),

tanh

var{

2

1

g

2

2

1

x
x
h
g
g

And its variance is

Example 2

: Importance Sampling

docsity.com

17

Choice of Importance Function

In a global sense, we want an importance function that matches the general behavior of the integrand at its maximum but also is similarover the whole range of integration. •

In the figure, g is the integrandwe wish to approximate.

The h

1

is importance function

derived from the Taylor seriesexpansion.

It is always greater than g.

The h

2

is a better importance

function because it describe gbetter over the entire range ofintegration.

5

10

15

26 24 22 20 18 16 14 12

g

h

2

h

1

Example 2

: Importance Sampling

docsity.com

The Procedure:

Let us do this example using MATLAB and explain how to choose the parameter

β

As a first step we run simple MC and find the integral. Its exact valueis

π

/4. We run this for several different values of N and find the

Example 2 standard deviation as a function of N. Then we repeat it for different choices of beta and keep a sufficientlylarge value of N constant. Once beta is selected that makes thevariance minimum then we check it for different values of N. The program and its results are now discussed further.

: Importance Sampling

docsity.com

Results of MATLAB Program

1 .0 x 1 0

2 .0 x 1 0

3 .0 x 1 0

m in [v a r{g }] a t

β

v a ria n c e {g }

β

Example 2

: Importance Sampling

docsity.com

Importance Sampling

0

10000

20000

30000

40000

0.8000.7980.7960.7940.7920.7900.7880.7860.7840.7820.

Average Area
N
Simple MC

Example 2

: Importance Sampling

docsity.com