Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this exercise we compute and simulate the push - forward map T that transforms a reference density r into a target density p .
In this exercise we compute and simulate the pushforward map T that transforms a reference density r into a
target density p Recall that the quantile function of a univariate random variable X is defined as the inverse of
its cumulative distribution function cdf F:
Fx PrX x Qu F
u u in
We assume F is continuous and strictly increasing so that Q F A nice property of the quantile function,
relevant to sampling, is that if U Uniform then QU F
In the following, do not confuse cdf signaled by uppercase letters with pdf ie density, signaled by lowercase
letters
pt Consider the Gaussian mixture model GMM with density pxlambda
sigma
phi
x
sigma
lambda
sigma
phi
x
sigma
where
phi is the density of the standard normal distribution mean and variance Implement the following to
create a dataset of n samples from the GMM p:
Sample Ui Uniform
If Ui lambda sample Xi N sigma
; otherwise sample Xi N sigma
Plot the histogram of the generated Xi with b bins and submit your script as
X GMMsamplegmm n b gmmlambda gmmmu gmmsigma
See here or here for how to plot a histogram in matplotlib or pandas or numpy if you insist
Ans: A
pts Compute Ui Phi
FXi where F is the cdf of the GMM in Ex and Phi is the cdf of standard
normal. Plot the histogram of the generated Ui with b bins From your inspection, what distribution should
Ui follow approximately Submit your script as GMMinvX gmm b
This page may be helpful.
Ans: A
pts Let Z N We now compute the pushforward map T so that TZ X p the GMM in Ex
We use the formula:
Tz QPhi z
where Phi is the cdf of the standard normal distribution and Q F
is the quantile function of X
namely the GMM p in Ex Implement the following binary search Algorithm to numerically
compute T Plot the function T with input z in increment Submit your main script as
BinarySearchF u lb ub maxiter tole where F is a function. You may need
to write another script to compute and plot T based on BinarySearch
Algorithm : Binary search for solving a monotonic nonlinear equation Fx u
Input: u in lb ub maxiter, tol
Output: x such that Fx u tol
while Flb u do lower bound too large
ub lb
lb lb
while Fub u do upper bound too small
lb ub
ub ub
for i maxiter do
x lbub
try middle point
t Fx
if t u then
ub x
else
lb x
if t u tol then
break
Ans: A
pts Sample independently Zi N i n and let X
i TZi where T is computed
by your BinarySearch. Plot the histogram of the generated X
i with b bins and submit your script as
PushForwardZ gmm Is the histogram similar to the one in Ex
Ans: A
pt Now let us compute U
i Phi
FX
i as in Ex with X
i
s being generated in Ex Plot
the histogram of the resulting U
i with b bins From your inspection what distribution should U
i follow
approximatelyNo need to submit any script, as you can recycle GMMinv.
Ans: A
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started