Home Am I implementing these equations correctly?
Reply: 0

Am I implementing these equations correctly?

user1302 Published in April 25, 2018, 10:53 am

I am trying to implement 2d Dimensional Gaussian Mixture Model

When I go through to recalculate the posterior probability using the variance and means that I calculated, I am getting the error that my SIGMA not positive square symmetric matrix.

The only thing I can think of is that I am implementing the equations wrong in MATLAB.

function [Weighted_Mu, Weighted_Sigma] = Iterative_Parameters_Calculator(Observations,Posteriors)
Weighted_Mu = [0,0];
Weighted_Sigma = [0 0; 0 0]; 
%Calculate the Means
Mu1 = sum(Posteriors(:,1).*Observations,1)/(sum(Posteriors(:,1),1));
Mu2 = sum(Posteriors(:,2).*Observations,1)/(sum(Posteriors(:,2),1));

Weighted_Mu = {Mu1,Mu2};

Sigma1(1,:) = sum(Posteriors(:,1).*(Observations - Mu1(1)).^2,1)/sum(Posteriors(:,1),1);
Sigma1(2,:) = sum(Posteriors(:,1).*(Observations - Mu1(2)).^2,1)/sum(Posteriors(:,1),1);
Sigma2(1,:) = sum(Posteriors(:,2).*(Observations - Mu2(1)).^2,1)/sum(Posteriors(:,2),1);
Sigma2(2,:) = sum(Posteriors(:,2).*(Observations - Mu1(2)).^2,1)/sum(Posteriors(:,2),1);

Weighted_Sigma = {Sigma1, Sigma2};

these are the equations

in the picture gamma is my posteriors, x is the observations, u is mu and sigma is sigma.

Is my implementation wrong?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.325278 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO