[mlpack] 41/58: Style changes. No code changes
Barak A. Pearlmutter
barak+git at cs.nuim.ie
Tue Sep 9 13:19:42 UTC 2014
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch svn-trunk
in repository mlpack.
commit 69184cfad50070548aa53717ec8d66c814a26d8c
Author: saxena.udit <saxena.udit at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date: Fri Aug 22 04:53:14 2014 +0000
Style changes. No code changes
git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17096 9d5b8971-822b-0410-80eb-d18c1038ef23
---
src/mlpack/methods/adaboost/adaboost.hpp | 6 ++++++
src/mlpack/methods/adaboost/adaboost_impl.hpp | 27 +++++++--------------------
src/mlpack/methods/adaboost/adaboost_main.cpp | 1 -
src/mlpack/tests/adaboost_test.cpp | 14 ++++++++------
4 files changed, 21 insertions(+), 27 deletions(-)
diff --git a/src/mlpack/methods/adaboost/adaboost.hpp b/src/mlpack/methods/adaboost/adaboost.hpp
index 96cfc04..6f56d23 100644
--- a/src/mlpack/methods/adaboost/adaboost.hpp
+++ b/src/mlpack/methods/adaboost/adaboost.hpp
@@ -59,6 +59,12 @@ class AdaBoost
// The tolerance for change in rt and when to stop.
double tolerance;
+ /**
+ * Classification Function.
+ * @param test Testing data.
+ * @param predictedLabels Vector to store the predicted labels of the
+ * test set.
+ */
void Classify(const MatType& test, arma::Row<size_t>& predictedLabels);
private:
diff --git a/src/mlpack/methods/adaboost/adaboost_impl.hpp b/src/mlpack/methods/adaboost/adaboost_impl.hpp
index e05c098..c884025 100644
--- a/src/mlpack/methods/adaboost/adaboost_impl.hpp
+++ b/src/mlpack/methods/adaboost/adaboost_impl.hpp
@@ -47,8 +47,7 @@ AdaBoost<MatType, WeakLearner>::AdaBoost(
tolerance = tol;
double rt, crt, alphat = 0.0, zt;
- // double tolerance = 1e-8;
- // std::cout<<"Tolerance is "<<tolerance<<"\n";
+
// crt is for stopping the iterations when rt
// stops changing by less than a tolerant value.
@@ -56,7 +55,6 @@ AdaBoost<MatType, WeakLearner>::AdaBoost(
// stops changing by less than a tolerant value.
ztProduct = 1.0;
- // ztAccumulator is
// To be used for prediction by the Weak Learner for prediction.
arma::Row<size_t> predictedLabels(labels.n_cols);
@@ -83,7 +81,6 @@ AdaBoost<MatType, WeakLearner>::AdaBoost(
// now start the boosting rounds
for (int i = 0; i < iterations; i++)
{
- // std::cout<<"Run "<<i<<" times.\n";
// Initialized to zero in every round.
// rt is used for calculation of alphat, is the weighted error
// rt = (sum)D(i)y(i)ht(xi)
@@ -95,12 +92,11 @@ AdaBoost<MatType, WeakLearner>::AdaBoost(
// Build the weight vectors
BuildWeightMatrix(D, weights);
- // std::cout<<"Just about to call the weak leaerner. \n";
// call the other weak learner and train the labels.
WeakLearner w(other, tempData, weights, labels);
w.Classify(tempData, predictedLabels);
- //Now from predictedLabels, build ht, the weak hypothesis
+ // Now from predictedLabels, build ht, the weak hypothesis
// buildClassificationMatrix(ht, predictedLabels);
// Now, start calculation of alpha(t) using ht
@@ -122,8 +118,6 @@ AdaBoost<MatType, WeakLearner>::AdaBoost(
}
}
// end calculation of rt
- // std::cout<<"Value of rt is: "<<rt<<"\n";
-
if (i > 0)
{
@@ -187,7 +181,6 @@ AdaBoost<MatType, WeakLearner>::AdaBoost(
// Iterations are over, now build a strong hypothesis
// from a weighted combination of these weak hypotheses.
- // std::cout<<"Just about to look at the final hypo.\n";
arma::colvec tempSumFinalH;
arma::uword max_index;
arma::mat sfh = sumFinalH.t();
@@ -202,7 +195,10 @@ AdaBoost<MatType, WeakLearner>::AdaBoost(
}
/**
- *
+ * Classification Function.
+ * @param test Testing data.
+ * @param predictedLabels Vector to store the predicted labels of the
+ * test set.
*/
template <typename MatType, typename WeakLearner>
void AdaBoost<MatType, WeakLearner>::Classify(
@@ -222,7 +218,7 @@ void AdaBoost<MatType, WeakLearner>::Classify(
for (int j = 0; j < tempPredictedLabels.n_cols; j++)
cMatrix(tempPredictedLabels(j), j) += (alpha[i] * tempPredictedLabels(j));
}
- // std::cout<<"Not working here ?\n";
+
arma::colvec cMRow;
arma::uword max_index;
@@ -258,15 +254,6 @@ void AdaBoost<MatType, WeakLearner>::BuildWeightMatrix(
}
}
-/*/**
- * Return the value of ztProduct
- */
- /*
-template <typename MatType, typename WeakLearner>
-double GetztProduct()
-{
- return ztProduct;
-}*/
} // namespace adaboost
} // namespace mlpack
diff --git a/src/mlpack/methods/adaboost/adaboost_main.cpp b/src/mlpack/methods/adaboost/adaboost_main.cpp
index ecc1cbc..8b204b9 100644
--- a/src/mlpack/methods/adaboost/adaboost_main.cpp
+++ b/src/mlpack/methods/adaboost/adaboost_main.cpp
@@ -64,7 +64,6 @@ PARAM_STRING("output", "The file in which the predicted labels for the test set"
" will be written.", "o", "output.csv");
PARAM_INT("iterations","The maximum number of boosting iterations "
"to be run", "i", 1000);
-// PARAM_INT("classes","The number of classes in the input label set.","c");
PARAM_DOUBLE("tolerance","The tolerance for change in values of rt","e",1e-10);
int main(int argc, char *argv[])
diff --git a/src/mlpack/tests/adaboost_test.cpp b/src/mlpack/tests/adaboost_test.cpp
index 1d8074a..f0edf85 100644
--- a/src/mlpack/tests/adaboost_test.cpp
+++ b/src/mlpack/tests/adaboost_test.cpp
@@ -573,9 +573,7 @@ BOOST_AUTO_TEST_CASE(WeakLearnerErrorNonLinearSepData_DS)
/**
* This test case runs the AdaBoost.mh algorithm on the UCI Vertebral
* Column dataset.
- * It tests the Classify function and checks if the error returned by
- * running the boosted weak learner using adaboost is comparable to the
- * error returned by running Classify() on the same function.
+ * It tests the Classify function and checks for a satisfiable error rate.
*/
BOOST_AUTO_TEST_CASE(ClassifyTest_VERTEBRALCOL)
{
@@ -620,9 +618,7 @@ BOOST_AUTO_TEST_CASE(ClassifyTest_VERTEBRALCOL)
/**
* This test case runs the AdaBoost.mh algorithm on a non linearly
* separable dataset.
- * It tests the Classify function and checks if the error returned by
- * running the boosted weak learner using adaboost is comparable to the
- * error returned by running Classify() on the same function.
+ * It tests the Classify function and checks for a satisfiable error rate.
*/
BOOST_AUTO_TEST_CASE(ClassifyTest_NONLINSEP)
{
@@ -667,6 +663,12 @@ BOOST_AUTO_TEST_CASE(ClassifyTest_NONLINSEP)
BOOST_REQUIRE(lError <= 0.30);
}
+/**
+ * This test case runs the AdaBoost.mh algorithm on the UCI Iris Dataset.
+ * It trains it on two thirds of the Iris dataset (iris_train.csv),
+ * and tests on the remaining third of the dataset (iris_test.csv).
+ * It tests the Classify function and checks for a satisfiable error rate.
+ */
BOOST_AUTO_TEST_CASE(ClassifyTest_IRIS)
{
arma::mat inputData;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list