gmmGaussianNumEstimate
Estimate the best number of Gaussians via cross validation
Contents
Syntax
- [bestGaussianNum, trainLl, testLl]=gmmGaussianNumEstimate(trainData, testData)
- [...]=gmmGaussianNumEstimate(trainData, testData, gmmOpt)
- [...]=gmmGaussianNumEstimate(trainData, testData, gmmOpt, plotOpt)
Description
[bestGaussianNum, trainLl, testLl]=gmmGaussianNumEstimate(trainData, testData, gmmOpt) returns the estimated number of Gaussians, together with training and test log likelihood for both the training and test data.
The best number of gaussians is determined according to where the minimum of test log likelihood occurs. (Usually the estimated number of Gaussians is usuallylarger than the desired number of Gaussians, as shown in the example.)
Example
DS=dcData(9); data=DS.input; subplot(2,1,1); hist(data, 50); title('Histogram of the dataset'); trainData=data(:, 1:2:end); testData=data(:, 2:2:end); gmmOpt=gmmTrain('defaultOpt'); gmmOpt.arch.gaussianNum=1:2:25; plotOpt=1; subplot(2,1,2); [bestGaussianNum, trainLl, testLl]=gmmGaussianNumEstimate(trainData, testData, gmmOpt, plotOpt);
1/13: No. of Gaussians=1, training LL=-842.222410, test LL=-857.282368 2/13: No. of Gaussians=3, training LL=-780.087879, test LL=-803.290118 3/13: No. of Gaussians=5, training LL=-732.834927, test LL=-777.971802 4/13: No. of Gaussians=7, training LL=-732.146950, test LL=-777.161722 5/13: No. of Gaussians=9, training LL=-730.739162, test LL=-780.454271 6/13: No. of Gaussians=11, training LL=-729.064591, test LL=-781.504832 7/13: No. of Gaussians=13, training LL=-729.095859, test LL=-781.588616 8/13: No. of Gaussians=15, training LL=-729.258673, test LL=-781.291006 9/13: No. of Gaussians=17, training LL=-729.241055, test LL=-781.824509 10/13: No. of Gaussians=19, training LL=-728.784842, test LL=-782.529531 11/13: No. of Gaussians=21, training LL=-728.569616, test LL=-782.790933 12/13: No. of Gaussians=23, training LL=-728.812633, test LL=-782.467639 13/13: No. of Gaussians=25, training LL=-728.846860, test LL=-782.403382