[mlpack-git] master: Reduce noise slightly and increase dataset size, which will slow down the test but make the results more accurate. (4d014e8)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 22:04:09 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

>---------------------------------------------------------------

commit 4d014e856a66bca889b7181300b173377778eeaa
Author: Ryan Curtin <ryan at ratml.org>
Date:   Tue Nov 25 16:57:08 2014 +0000

    Reduce noise slightly and increase dataset size, which will slow down the test
    but make the results more accurate.


>---------------------------------------------------------------

4d014e856a66bca889b7181300b173377778eeaa
 src/mlpack/tests/gmm_test.cpp | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/mlpack/tests/gmm_test.cpp b/src/mlpack/tests/gmm_test.cpp
index 7bbae69..e043376 100644
--- a/src/mlpack/tests/gmm_test.cpp
+++ b/src/mlpack/tests/gmm_test.cpp
@@ -225,8 +225,6 @@ BOOST_AUTO_TEST_CASE(GMMTrainEMMultipleGaussians)
  */
 BOOST_AUTO_TEST_CASE(GMMTrainEMSingleGaussianWithProbability)
 {
-  math::RandomSeed(std::time(NULL));
-
   // Generate observations from a Gaussian distribution.
   distribution::GaussianDistribution d("0.5 1.0", "1.0 0.3; 0.3 1.0");
 
@@ -261,8 +259,6 @@ BOOST_AUTO_TEST_CASE(GMMTrainEMSingleGaussianWithProbability)
  */
 BOOST_AUTO_TEST_CASE(GMMTrainEMMultipleGaussiansWithProbability)
 {
-  srand(time(NULL));
-
   // We'll have three Gaussian distributions from this mixture, and one Gaussian
   // not from this mixture (but we'll put some observations from it in).
   distribution::GaussianDistribution d1("0.0 1.0 0.0", "1.0 0.0 0.5;"
@@ -280,10 +276,10 @@ BOOST_AUTO_TEST_CASE(GMMTrainEMMultipleGaussiansWithProbability)
 
   // Now we'll generate points and probabilities.  1500 points.  Slower than I
   // would like...
-  arma::mat points(3, 2000);
-  arma::vec probabilities(2000);
+  arma::mat points(3, 5000);
+  arma::vec probabilities(5000);
 
-  for (size_t i = 0; i < 2000; i++)
+  for (size_t i = 0; i < 5000; i++)
   {
     double randValue = math::Random();
 
@@ -300,8 +296,8 @@ BOOST_AUTO_TEST_CASE(GMMTrainEMMultipleGaussiansWithProbability)
     // 0.97 plus or minus a little bit of noise.  If not, then it should be 0.03
     // plus or minus a little bit of noise.  The base probability (minus the
     // noise) is parameterizable for easy modification of the test.
-    double confidence = 0.995;
-    double perturbation = math::Random(-0.005, 0.005);
+    double confidence = 0.998;
+    double perturbation = math::Random(-0.002, 0.002);
 
     if (randValue <= 0.90)
       probabilities(i) = confidence + perturbation;



More information about the mlpack-git mailing list