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=-860.012614, test LL=-861.519924 2/13: No. of Gaussians=3, training LL=-788.144759, test LL=-802.060750 3/13: No. of Gaussians=5, training LL=-749.973898, test LL=-767.687532 4/13: No. of Gaussians=7, training LL=-749.706620, test LL=-767.932635 5/13: No. of Gaussians=9, training LL=-745.659400, test LL=-774.328939 6/13: No. of Gaussians=11, training LL=-745.551292, test LL=-773.703669 7/13: No. of Gaussians=13, training LL=-744.003178, test LL=-781.174938 8/13: No. of Gaussians=15, training LL=-741.259317, test LL=-785.536985 9/13: No. of Gaussians=17, training LL=-741.006037, test LL=-784.586421 10/13: No. of Gaussians=19, training LL=-740.398920, test LL=-785.244052 11/13: No. of Gaussians=21, training LL=-740.251365, test LL=-784.997333 12/13: No. of Gaussians=23, training LL=-740.320322, test LL=-785.480987 13/13: No. of Gaussians=25, training LL=-740.414702, test LL=-785.618763
![](gmmGaussianNumEstimate_help_01.png)