MATLAB Answers

Yihan Ma
0

Why the result of GMM(Gaussian mixture model) is not the same for twice calculation?

Asked by Yihan Ma
on 27 Mar 2019
Latest activity Commented on by the cyclist
on 28 Mar 2019
When I try to use GMM to fitting a 1000 by 1 array, the result of GMM is totally different for twice simluation.
When I try to use 5 one dimension Gaussian plots to fitting the data,
The first time result of Mu_1=[0.6024; 0.4846; 0.5539; 0.6394; 0.4156]; and the second time result of Mu_2=[0.5433; 0.6574; 0.4666; 0.4642; 0.5579];
I don't know why the result is not the same.
The data is attached.

  0 Comments

Sign in to comment.

1 Answer

Answer by the cyclist
on 27 Mar 2019
 Accepted Answer

There is a random component to the fitting algorithm. The results will not be exactly the same each time, because the pseudorandom number generator will not give the same values each time through.
If you put the line
rng default
at the beginning of your code, it will start the generator at the default location each time, and you will get the same results.
Also, given that your data doesn't really look like five gaussians, I am not surprised that you get unstable results. Or maybe I misunderstand something.
test.png

  2 Comments

Thanks for your reply.
I understand what you mean. But I have another question.
If the result is not the same, how could use this method to classify diiferent data?
I mean, if I have many different of types, if I generate the GMM results one by one, even the same data has different GMM results. Could I classify these data?
All modeling methods have error. The only advice I can offer is to try to understand your method(s) well enough that you really understand that error.

Sign in to comment.