How to extract data for a particular gaussian component in GMM

8 views (last 30 days)
HI, I'm writing this code for Gaussian mixture model:
for j = 1:K
densEst(pointsObserved,j) = mvnpdf(X(pointsObserved,:),theta.mu(:,j)',squeeze(theta.Sigma(:,:,j)));
end
for j = 1:K
expectations.z(:,j) = theta.tau(j)*densEst(:,j)./sum(repmat(theta.tau,N,1).*densEst,2);
end
If let say, after i estimate the responsibility for each data points, i want to extract the data which are only belong to the first gaussian component. Do anyone here know how to do that? I found a sample code to extract the data based on cluster membership: http://uk.mathworks.com/help/stats/cluster-data-from-mixture-of-gaussian-distributions.html
However, this code is implemented using built-in function:
options = statset('Display','final');
gm = fitgmdist(X,2,'Options',options)
idx = cluster(gm,X);
cluster1 = (idx == 1); % |1| for cluster 1 membership
cluster2 = (idx == 2); % |2| for cluster 2 membership
Thank you in advance

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!