

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Machine Learning (CS 5350/CS 6350) Due 29 Mar 2007
Note: Please submit the written aspects of assignments in postscript or PDF format only. I highly recom- mend you use LATEX to prepare the assignments. A solution will be posted here after the due date. See http://www.cs.utah.edu/classes/cs5350/handin.html for handin instructions.
None!
In the programming aspect of this assignment, we will revisit a Gaussian mixture model, but this time from a Bayesian perspective.
Suppose we have the following model. We have two Gaussians with unknown means μ 1 and μ 1. Both have variance 1 (this if fixed). We put a Gaussian prior on these means with a common mean 0 and variance 1. Also for simplicity, we’ll assume that each cluster is apriori equally likely (i.e., π = 0.5). That is, we have:
p(x1:N ) =
dμ 0
dμ 1 Nor(μ 0 | 0 , 1)Nor(μ 1 | 0 , 1)
n
zn∈{ 0 , 1 }
Nor(xn | μzn , 1)
The data is provided in hw5.m in the variable X. There are 20 data points in two dimensions.
In order to do the sampling, you first need to implement the log probability(X, mu1, mu2, z) function. This should compute the value log p(X1:N , μ 0 , μ 1 , z); essentially the value in the above excluding the integrals and sum. This is to compute the p function.
Next, we will implement an importance sampler and a Metropolis-Hastings sampler.
For the importance sampler, you should use the following proposal distributions:
q(μ 0 ) = Nor(μ 0 | 0 , 1) q(μ 1 ) = Nor(μq | 0 , 1) q(zn) = Bin(0.5)
That is, draw the μs from the prior mean, and draw each z from a fair coin flip.
Machine Learning (CS 5350/CS 6350) 2
Initialize the sampler by drawing values directly according to the proposal distribution. Run the sampler for 1000 iterations. Plot a trace of the means over the 1000 iterations. Do they seem to converge to reasonable values? How long does this take? Repeat this process five times. Hand in graphs for the “best” trace and analyze the trends.
Next, for the MH sampler, we will use the following proposal distributions:
q(μ 0 ) = Nor(μ 0 | μ 0 , 1) q(μ 1 ) = Nor(μ 1 | μ 1 , 1) q(zn) = Bin((1 + zn)/3)
Repeat the same process as for the importance sampler (still initializing with the importance sampler’s proposal distributions). Turn in the same.