Question
Implement the EM algorithm for ap-dimensional Gaussian mixture model withGcompo- nents: G pkN(x;k,).k=1 Store the estimated parameters as a list inRwith three components prob:G-dimensional probability
Implement the EM algorithm for ap-dimensional Gaussian mixture model withGcompo-
nents:
G
pkN(x;k,).k=1
Store the estimated parameters as a list inRwith three components
prob:G-dimensional probability vector (p1, . . . , pG)
mean:p-by-Gmatrix with thek-th column beingk, thep-dimensional mean for thek-th Gaussian component;
Sigma:p-by-pcovariance matrix shared by allGcomponents.Structure of your codeshould look like the following.
Estep
# Return the n-by-G probability matrix}
Mstep
}
myEM
post.prob
para
return(para) }
Test your code on thefaithfuldata fromRpackagemclustwithG= 2 andG= 3.The estimated parameters from your algorithm and the ones frommclustafter 20 iterations should be the same.
Implement all the computation by your own code; do not use any libraries except loading the test data frommclust.
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