MATLAB GMM by fitgmdist gives different values even after initializing using kmeans

조회 수: 8 (최근 30일)
So I am trying to compare two Gaussian Mixture Models with two distributions every time I run the program i get different values even after initializing using k-means. Am I missing something??
X = mat_cell;
[counts,binLocations] = imhist(X);
stem(binLocations, counts, 'MarkerSize', 1 );
xlim([-1 1]);
% inital kmeans step used to initialize EM
K = 2; % number of mixtures/clusters
cInd = kmeans(X(:), K,'MaxIter', 75536);
% fit a GMM model
options = statset('MaxIter', 75536);
gmm = fitgmdist(X(:),K,'Start',cInd,'CovarianceType','diagonal','Regularize',1e-5,'Options',options);
  댓글 수: 5
SAFAA ALQAYSI
SAFAA ALQAYSI 2017년 9월 13일
Adem would you please let me know the way you did with GMM and the hierarchical clustering ????
Thanks
Catherine Davey
Catherine Davey 2023년 5월 7일
K-means is not deterministic. Given that K-means will give a different result each time it is run, you cannot use it to ensure identical runs for the GMM algorithm.

댓글을 달려면 로그인하십시오.

답변 (1개)

the cyclist
the cyclist 2017년 6월 23일
Set the seed for the pseudorandom number generation in your code. For example, put the line
rng 'default'
as the first line.
This will give you a pseudorandom sequence, but it will be reproducible.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by