I have implemented the exp. maximization algorithm and it converges and returns the values of mu
and sigma
correctly, I have checked with various examples.
I have tried to plot the log-likelihood, but I don't know how it will look in the correct form?
Here is the equation:
And my plot, y is the log-likelihood value, x the iteration number.
The negative values are very strange, maybe I should normalize the likelihood? What the log-likelihood means in Exp. Maximization?
logLikelihood = 0;
for i = 1 : n
logTemp = 0;
for j = 1 : k
logTemp = logTemp + p(j) * mvnpdf(x(i,:), mu(j,:), sigma(:,:,j));
end
logLikelihood = logLikelihood + log(logTemp);
end
plot(iteration, logLikelihood,'r*');
hold on;