[mlpack-git] master, mlpack-1.0.x: Minor changes to test. const-correctness and comment normalization for Doxygen. (4ecf788)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:49:33 EST 2015
Repository : https://github.com/mlpack/mlpack
On branches: master,mlpack-1.0.x
Link : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40
>---------------------------------------------------------------
commit 4ecf78854acddaaae5cc772a80c38abfcd0a116a
Author: Ryan Curtin <ryan at ratml.org>
Date: Tue Jun 24 16:39:28 2014 +0000
Minor changes to test. const-correctness and comment normalization for Doxygen.
>---------------------------------------------------------------
4ecf78854acddaaae5cc772a80c38abfcd0a116a
src/mlpack/tests/decision_stump_test.cpp | 103 +++++++++++++++----------------
1 file changed, 51 insertions(+), 52 deletions(-)
diff --git a/src/mlpack/tests/decision_stump_test.cpp b/src/mlpack/tests/decision_stump_test.cpp
index 840b6f7..c826295 100644
--- a/src/mlpack/tests/decision_stump_test.cpp
+++ b/src/mlpack/tests/decision_stump_test.cpp
@@ -1,10 +1,9 @@
-/*
- * @file decision_stump_test.cpp
- * @author Udit Saxena
+/**
+ * @file decision_stump_test.cpp
+ * @author Udit Saxena
*
- * Test for Decision Stump
+ * Tests for DecisionStump class.
*/
-
#include <mlpack/core.hpp>
#include <mlpack/methods/decision_stump/decision_stump.hpp>
@@ -15,27 +14,27 @@ using namespace mlpack;
using namespace mlpack::decision_stump;
using namespace arma;
-BOOST_AUTO_TEST_SUITE(DSTEST);
+BOOST_AUTO_TEST_SUITE(DecisionStumpTest);
-/*
-This tests handles the case wherein only one class exists in the input labels.
-It checks whether the only class supplied was the only class predicted.
+/**
+ * This tests handles the case wherein only one class exists in the input
+ * labels. It checks whether the only class supplied was the only class
+ * predicted.
*/
BOOST_AUTO_TEST_CASE(OneClass)
{
- size_t numClasses = 2;
- size_t inpBucketSize = 6;
+ const size_t numClasses = 2;
+ const size_t inpBucketSize = 6;
mat trainingData;
trainingData << 2.4 << 3.8 << 3.8 << endr
- << 1 << 1 << 2 << endr
+ << 1 << 1 << 2 << endr
<< 1.3 << 1.9 << 1.3 << endr;
+ // No need to normalize labels here.
Mat<size_t> labelsIn;
labelsIn << 1 << 1 << 1;
- // no need to normalize labels here.
-
mat testingData;
testingData << 2.4 << 2.5 << 2.6;
@@ -44,29 +43,29 @@ BOOST_AUTO_TEST_CASE(OneClass)
Row<size_t> predictedLabels(testingData.n_cols);
ds.Classify(testingData, predictedLabels);
- for(size_t i = 0; i < predictedLabels.size(); i++ )
- BOOST_CHECK_EQUAL(predictedLabels(i),1);
+ for (size_t i = 0; i < predictedLabels.size(); i++ )
+ BOOST_CHECK_EQUAL(predictedLabels(i), 1);
}
-/*
-This tests for the classification:
- if testinput < 0 - class 0
- if testinput > 0 - class 1
-An almost perfect split on zero.
-*/
+/**
+ * This tests for the classification:
+ * if testinput < 0 - class 0
+ * if testinput > 0 - class 1
+ * An almost perfect split on zero.
+ */
BOOST_AUTO_TEST_CASE(PerfectSplitOnZero)
{
- size_t numClasses = 2;
+ const size_t numClasses = 2;
const char* output = "outputPerfectSplitOnZero.csv";
- size_t inpBucketSize = 2;
+ const size_t inpBucketSize = 2;
mat trainingData;
trainingData << -1 << 1 << -2 << 2 << -3 << 3;
+ // No need to normalize labels here.
Mat<size_t> labelsIn;
labelsIn << 0 << 1 << 0 << 1 << 0 << 1;
- // no need to normalize labels here.
mat testingData;
testingData << -4 << 7 << -7 << -5 << 6;
@@ -79,24 +78,23 @@ BOOST_AUTO_TEST_CASE(PerfectSplitOnZero)
data::Save(output, predictedLabels, true, true);
}
-/*
-This tests the binning function for the case when a dataset with
-cardinality of input < inpBucketSize is provided.
-*/
+/**
+ * This tests the binning function for the case when a dataset with cardinality
+ * of input < inpBucketSize is provided.
+ */
BOOST_AUTO_TEST_CASE(BinningTesting)
{
- size_t numClasses = 2;
+ const size_t numClasses = 2;
const char* output = "outputBinningTesting.csv";
- size_t inpBucketSize = 10;
+ const size_t inpBucketSize = 10;
mat trainingData;
trainingData << -1 << 1 << -2 << 2 << -3 << 3 << -4;
+ // No need to normalize labels here.
Mat<size_t> labelsIn;
labelsIn << 0 << 1 << 0 << 1 << 0 << 1 << 0;
- // no need to normalize labels here.
-
mat testingData;
testingData << 5;
@@ -108,25 +106,25 @@ BOOST_AUTO_TEST_CASE(BinningTesting)
data::Save(output, predictedLabels, true, true);
}
-/*
-This is a test for the case when non-overlapping, multiple
-classes are provided. It tests for a perfect split due to the
-non-overlapping nature of the input classes.
-*/
+/**
+ * This is a test for the case when non-overlapping, multiple classes are
+ * provided. It tests for a perfect split due to the non-overlapping nature of
+ * the input classes.
+ */
BOOST_AUTO_TEST_CASE(PerfectMultiClassSplit)
{
- size_t numClasses = 4;
+ const size_t numClasses = 4;
const char* output = "outputPerfectMultiClassSplit.csv";
- size_t inpBucketSize = 3;
+ const size_t inpBucketSize = 3;
mat trainingData;
trainingData << -8 << -7 << -6 << -5 << -4 << -3 << -2 << -1
- << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7;
+ << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7;
+ // No need to normalize labels here.
Mat<size_t> labelsIn;
labelsIn << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1
<< 2 << 2 << 2 << 2 << 3 << 3 << 3 << 3;
- // no need to normalize labels here.
mat testingData;
testingData << -6.1 << -2.1 << 1.1 << 5.1;
@@ -139,26 +137,27 @@ BOOST_AUTO_TEST_CASE(PerfectMultiClassSplit)
data::Save(output, predictedLabels, true, true);
}
-/*
-This test is for the case when reasonably overlapping, multiple classes
-are provided in the input label set. It tests whether classification
-takes place with a reasonable amount of error due to the overlapping
-nature of input classes.
-*/
+/**
+ * This test is for the case when reasonably overlapping, multiple classes are
+ * provided in the input label set. It tests whether classification takes place
+ * with a reasonable amount of error due to the overlapping nature of input
+ * classes.
+ */
BOOST_AUTO_TEST_CASE(MultiClassSplit)
{
- size_t numClasses = 3;
+ const size_t numClasses = 3;
const char* output = "outputMultiClassSplit.csv";
- size_t inpBucketSize = 3;
+ const size_t inpBucketSize = 3;
mat trainingData;
trainingData << -7 << -6 << -5 << -4 << -3 << -2 << -1 << 0 << 1
- << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10;
+ << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10;
+ // No need to normalize labels here.
Mat<size_t> labelsIn;
labelsIn << 0 << 0 << 0 << 0 << 1 << 1 << 0 << 0
<< 1 << 1 << 1 << 2 << 1 << 2 << 2 << 2 << 2 << 2;
- // no need to normalize labels here.
+
mat testingData;
testingData << -6.1 << -5.9 << -2.1 << -0.7 << 2.5 << 4.7 << 7.2 << 9.1;
More information about the mlpack-git
mailing list