[mlpack-git] master: Fix uninitialized memory issue (dsPredictions was never set). (a63e408)

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


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

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

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

commit a63e408ee66fb366fe4419c65939e408752772a6
Author: Ryan Curtin <ryan at ratml.org>
Date:   Tue Nov 18 22:03:12 2014 +0000

    Fix uninitialized memory issue (dsPredictions was never set).


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

a63e408ee66fb366fe4419c65939e408752772a6
 src/mlpack/tests/adaboost_test.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/mlpack/tests/adaboost_test.cpp b/src/mlpack/tests/adaboost_test.cpp
index f0edf85..b54d9f6 100644
--- a/src/mlpack/tests/adaboost_test.cpp
+++ b/src/mlpack/tests/adaboost_test.cpp
@@ -207,7 +207,7 @@ BOOST_AUTO_TEST_CASE(HammingLossBoundNonLinearSepData)
 
   arma::Mat<size_t> labels;
 
-  if (!data::Load("nonlinsepdata_labels.txt",labels))
+  if (!data::Load("nonlinsepdata_labels.txt", labels))
     BOOST_FAIL("Cannot load labels for nonlinsepdata_labels.txt");
 
   // no need to map the labels here
@@ -354,6 +354,7 @@ BOOST_AUTO_TEST_CASE(WeakLearnerErrorIris_DS)
 
   decision_stump::DecisionStump<> ds(inputData, labels.row(0),
                                      numClasses, inpBucketSize);
+  ds.Classify(inputData, dsPrediction);
 
   int countWeakLearnerError = 0;
   for (size_t i = 0; i < labels.n_cols; i++)
@@ -577,6 +578,7 @@ BOOST_AUTO_TEST_CASE(WeakLearnerErrorNonLinearSepData_DS)
  */
 BOOST_AUTO_TEST_CASE(ClassifyTest_VERTEBRALCOL)
 {
+  math::RandomSeed(std::time(NULL));
   arma::mat inputData;
 
   if (!data::Load("vc2.txt", inputData))
@@ -591,14 +593,14 @@ BOOST_AUTO_TEST_CASE(ClassifyTest_VERTEBRALCOL)
 
   // Define your own weak learner, perceptron in this case.
   // Run the perceptron for perceptron_iter iterations.
-  int perceptron_iter = 800;
+  int perceptron_iter = 5000;
 
   arma::Row<size_t> perceptronPrediction(labels.n_cols);
   perceptron::Perceptron<> p(inputData, labels.row(0), perceptron_iter);
   p.Classify(inputData, perceptronPrediction);
 
   // Define parameters for the adaboost
-  int iterations = 50;
+  int iterations = 250;
   double tolerance = 1e-10;
   AdaBoost<> a(inputData, labels.row(0), iterations, tolerance, p);
 
@@ -612,7 +614,7 @@ BOOST_AUTO_TEST_CASE(ClassifyTest_VERTEBRALCOL)
       localError++;
   double lError = (double) localError / labels.n_cols;
 
-  BOOST_REQUIRE(lError <= 0.30);
+  BOOST_REQUIRE_LT(lError, 0.30);
 }
 
 /**



More information about the mlpack-git mailing list