This test creates a random multivariate Gaussian mixture. It then samples from this mixture and compares the mean and covariance of the original mixture with the mean and covariance of the sample set.
Results are as follows:
True mean [10](-0.371772,0.0247794,-0.694436,-0.725477,-0.173395,0.254179,0.265875,-0.182584,-1.58268,-0.180564) True covariance [10,10]((10.5105,4.9164,4.00708,-0.847463,1.90695,0.429748,-3.92799,2.61662,-0.352928,2.96024),(4.9164,6.14985,4.91685,-1.44669,2.62529,2.4311,0.696597,-2.91803,-2.05872,0.126531),(4.00708,4.91685,8.32903,2.01725,5.56143,2.20605,2.29597,-4.09557,0.0988245,2.44746),(-0.847463,-1.44669,2.01725,9.72564,2.23329,-2.03402,2.25253,-2.63657,2.6772,5.0114),(1.90695,2.62529,5.56143,2.23329,5.69025,0.915081,0.542488,-4.27499,1.55459,1.77627),(0.429748,2.4311,2.20605,-2.03402,0.915081,4.02748,3.03814,-0.743788,-2.8001,-1.10317),(-3.92799,0.696597,2.29597,2.25253,0.542488,3.03814,8.89757,-3.85311,-4.73507,-2.20367),(2.61662,-2.91803,-4.09557,-2.63657,-4.27499,-0.743788,-3.85311,9.29706,1.25019,2.46312),(-0.352928,-2.05872,0.0988245,2.6772,1.55459,-2.8001,-4.73507,1.25019,8.54087,5.22541),(2.96024,0.126531,2.44746,5.0114,1.77627,-1.10317,-2.20367,2.46312,5.22541,9.5591)) Sample mean [10](-0.354978,0.0402824,-0.690684,-0.733938,-0.179061,0.256176,0.263299,-0.179635,-1.59133,-0.175031) Sample covariance [10,10]((10.5329,4.91685,4.03362,-0.843003,1.92822,0.425518,-3.95874,2.6348,-0.316678,2.97982),(4.91685,6.15352,4.94511,-1.4311,2.63918,2.42427,0.690618,-2.91539,-2.01865,0.159001),(4.03362,4.94511,8.34564,2.01138,5.55796,2.20644,2.2803,-4.09631,0.0854599,2.4385),(-0.843003,-1.4311,2.01138,9.74033,2.23626,-2.04368,2.21965,-2.6652,2.67621,5.01811),(1.92822,2.63918,5.55796,2.23626,5.67588,0.914149,0.521844,-4.2655,1.54411,1.77174),(0.425518,2.42427,2.20644,-2.04368,0.914149,4.01856,3.04161,-0.73472,-2.78708,-1.10293),(-3.95874,0.690618,2.2803,2.21965,0.521844,3.04161,8.90912,-3.85286,-4.74951,-2.21991),(2.6348,-2.91539,-4.09631,-2.6652,-4.2655,-0.73472,-3.85286,9.31208,1.23451,2.4471),(-0.316678,-2.01865,0.0854599,2.67621,1.54411,-2.78708,-4.74951,1.23451,8.50133,5.21011),(2.97982,0.159001,2.4385,5.01811,1.77174,-1.10293,-2.21991,2.4471,5.21011,9.54923))
Definition in file test6.cpp.
Go to the source code of this file.
Functions | |
| aux::GaussianPdf | createRandomGaussian (const unsigned int M, const double minMean=-5.0, const double maxMean=5.0, const double minCov=0.0, const double maxCov=5.0) |
| Create random Gaussian distribution. | |
| int | main (int argc, const char *argv[]) |
| Run tests. | |
Variables | |
| unsigned int | M = 10 |
| Dimensionality of the Gaussian mixture. | |
| unsigned int | COMPONENTS = 12 |
| Number of components in the Gaussian mixture. | |
| unsigned int | N = 100000 |
| Number of samples to take. | |
| aux::GaussianPdf createRandomGaussian | ( | const unsigned int | M, | |
| const double | minMean = -5.0, |
|||
| const double | maxMean = 5.0, |
|||
| const double | minCov = 0.0, |
|||
| const double | maxCov = 5.0 | |||
| ) |
Create random Gaussian distribution.
| M | Dimensionality of the Gaussian. | |
| minMean | Minimum value of any component of the mean. | |
| maxMean | Maximum value of any component of the mean. | |
| minCov | Minimum value of any component of the covariance. | |
| maxCov | Maximum value of any component of the covariance. |
| unsigned int COMPONENTS = 12 |
| unsigned int M = 10 |
1.5.3