[mlpack-git] master: Reorder template parameters for consistency. (782e446)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Fri Dec 11 12:46:50 EST 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/dd7c8b93fe5f299cb534cda70c1c786456f9a78f...3b926fd86ab143eb8af7327b9fb89fead7538df0

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

commit 782e446a44a4d17059361cd43f2066d46c6ce497
Author: Ryan Curtin <ryan at ratml.org>
Date:   Fri Dec 11 02:51:56 2015 +0000

    Reorder template parameters for consistency.


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

782e446a44a4d17059361cd43f2066d46c6ce497
 src/mlpack/methods/adaboost/adaboost.hpp      |  4 ++--
 src/mlpack/methods/adaboost/adaboost_impl.hpp | 20 ++++++++++----------
 src/mlpack/tests/adaboost_test.cpp            | 20 ++++++++++----------
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/mlpack/methods/adaboost/adaboost.hpp b/src/mlpack/methods/adaboost/adaboost.hpp
index 678831b..d044951 100644
--- a/src/mlpack/methods/adaboost/adaboost.hpp
+++ b/src/mlpack/methods/adaboost/adaboost.hpp
@@ -71,8 +71,8 @@ namespace adaboost {
  * @tparam MatType Data matrix type (i.e. arma::mat or arma::sp_mat).
  * @tparam WeakLearnerType Type of weak learner to use.
  */
-template<typename MatType = arma::mat,
-         typename WeakLearnerType = mlpack::perceptron::Perceptron<> >
+template<typename WeakLearnerType = mlpack::perceptron::Perceptron<>,
+         typename MatType = arma::mat>
 class AdaBoost
 {
  public:
diff --git a/src/mlpack/methods/adaboost/adaboost_impl.hpp b/src/mlpack/methods/adaboost/adaboost_impl.hpp
index ee400e0..9800255 100644
--- a/src/mlpack/methods/adaboost/adaboost_impl.hpp
+++ b/src/mlpack/methods/adaboost/adaboost_impl.hpp
@@ -35,8 +35,8 @@ namespace adaboost {
  * @param tol Tolerance for termination of Adaboost.MH.
  * @param other Weak Learner, which has been initialized already.
  */
-template<typename MatType, typename WeakLearnerType>
-AdaBoost<MatType, WeakLearnerType>::AdaBoost(
+template<typename WeakLearnerType, typename MatType>
+AdaBoost<WeakLearnerType, MatType>::AdaBoost(
     const MatType& data,
     const arma::Row<size_t>& labels,
     const WeakLearnerType& other,
@@ -47,16 +47,16 @@ AdaBoost<MatType, WeakLearnerType>::AdaBoost(
 }
 
 // Empty constructor.
-template<typename MatType, typename WeakLearnerType>
-AdaBoost<MatType, WeakLearnerType>::AdaBoost(const double tolerance) :
+template<typename WeakLearnerType, typename MatType>
+AdaBoost<WeakLearnerType, MatType>::AdaBoost(const double tolerance) :
     tolerance(tolerance)
 {
   // Nothing to do.
 }
 
 // Train AdaBoost.
-template<typename MatType, typename WeakLearnerType>
-void AdaBoost<MatType, WeakLearnerType>::Train(
+template<typename WeakLearnerType, typename MatType>
+void AdaBoost<WeakLearnerType, MatType>::Train(
     const MatType& data,
     const arma::Row<size_t>& labels,
     const WeakLearnerType& other,
@@ -188,8 +188,8 @@ void AdaBoost<MatType, WeakLearnerType>::Train(
 /**
  * Classify the given test points.
  */
-template<typename MatType, typename WeakLearnerType>
-void AdaBoost<MatType, WeakLearnerType>::Classify(
+template<typename WeakLearnerType, typename MatType>
+void AdaBoost<WeakLearnerType, MatType>::Classify(
     const MatType& test,
     arma::Row<size_t>& predictedLabels)
 {
@@ -221,9 +221,9 @@ void AdaBoost<MatType, WeakLearnerType>::Classify(
 /**
  * Serialize the AdaBoost model.
  */
-template<typename MatType, typename WeakLearnerType>
+template<typename WeakLearnerType, typename MatType>
 template<typename Archive>
-void AdaBoost<MatType, WeakLearnerType>::Serialize(Archive& ar,
+void AdaBoost<WeakLearnerType, MatType>::Serialize(Archive& ar,
                                                const unsigned int /* version */)
 {
   ar & data::CreateNVP(classes, "classes");
diff --git a/src/mlpack/tests/adaboost_test.cpp b/src/mlpack/tests/adaboost_test.cpp
index 829438e..c22b521 100644
--- a/src/mlpack/tests/adaboost_test.cpp
+++ b/src/mlpack/tests/adaboost_test.cpp
@@ -300,7 +300,7 @@ BOOST_AUTO_TEST_CASE(HammingLossIris_DS)
   // Define parameters for AdaBoost.
   size_t iterations = 50;
   double tolerance = 1e-10;
-  AdaBoost<mat, DecisionStump<>> a(inputData, labels.row(0), ds, iterations,
+  AdaBoost<DecisionStump<>> a(inputData, labels.row(0), ds, iterations,
       tolerance);
 
   arma::Row<size_t> predictedLabels;
@@ -352,7 +352,7 @@ BOOST_AUTO_TEST_CASE(WeakLearnerErrorIris_DS)
   size_t iterations = 50;
   double tolerance = 1e-10;
 
-  AdaBoost<mat, DecisionStump<>> a(inputData, labels.row(0), ds, iterations,
+  AdaBoost<DecisionStump<>> a(inputData, labels.row(0), ds, iterations,
       tolerance);
 
   arma::Row<size_t> predictedLabels;
@@ -393,7 +393,7 @@ BOOST_AUTO_TEST_CASE(HammingLossBoundVertebralColumn_DS)
   size_t iterations = 50;
   double tolerance = 1e-10;
 
-  AdaBoost<mat, DecisionStump<>> a(inputData, labels.row(0), ds, iterations,
+  AdaBoost<DecisionStump<>> a(inputData, labels.row(0), ds, iterations,
       tolerance);
 
   arma::Row<size_t> predictedLabels;
@@ -441,7 +441,7 @@ BOOST_AUTO_TEST_CASE(WeakLearnerErrorVertebralColumn_DS)
   // Define parameters for AdaBoost.
   size_t iterations = 50;
   double tolerance = 1e-10;
-  AdaBoost<mat, DecisionStump<>> a(inputData, labels.row(0), ds, iterations,
+  AdaBoost<DecisionStump<>> a(inputData, labels.row(0), ds, iterations,
       tolerance);
 
   arma::Row<size_t> predictedLabels;
@@ -481,7 +481,7 @@ BOOST_AUTO_TEST_CASE(HammingLossBoundNonLinearSepData_DS)
   size_t iterations = 50;
   double tolerance = 1e-10;
 
-  AdaBoost<mat, DecisionStump<> > a(inputData, labels.row(0), ds, iterations,
+  AdaBoost<DecisionStump<> > a(inputData, labels.row(0), ds, iterations,
       tolerance);
 
   arma::Row<size_t> predictedLabels;
@@ -530,7 +530,7 @@ BOOST_AUTO_TEST_CASE(WeakLearnerErrorNonLinearSepData_DS)
   size_t iterations = 500;
   double tolerance = 1e-23;
 
-  AdaBoost<mat, DecisionStump<> > a(inputData, labels.row(0), ds, iterations,
+  AdaBoost<DecisionStump<> > a(inputData, labels.row(0), ds, iterations,
       tolerance);
 
   arma::Row<size_t> predictedLabels;
@@ -633,7 +633,7 @@ BOOST_AUTO_TEST_CASE(ClassifyTest_NONLINSEP)
   // Define parameters for AdaBoost.
   size_t iterations = 50;
   double tolerance = 1e-10;
-  AdaBoost<mat, DecisionStump<> > a(inputData, labels.row(0), ds, iterations,
+  AdaBoost<DecisionStump<> > a(inputData, labels.row(0), ds, iterations,
       tolerance);
 
   arma::Row<size_t> predictedLabels(testData.n_cols);
@@ -822,7 +822,7 @@ BOOST_AUTO_TEST_CASE(DecisionStumpSerializationTest)
     labels[i] = 1;
 
   DecisionStump<> p(data, labels, 2, 800);
-  AdaBoost<mat, DecisionStump<>> ab(data, labels, p, 50, 1e-10);
+  AdaBoost<DecisionStump<>> ab(data, labels, p, 50, 1e-10);
 
   // Now create another dataset to train with.
   mat otherData = randu<mat>(5, 200);
@@ -835,9 +835,9 @@ BOOST_AUTO_TEST_CASE(DecisionStumpSerializationTest)
     otherLabels[i] = 2;
 
   DecisionStump<> p2(otherData, otherLabels, 3, 500);
-  AdaBoost<mat, DecisionStump<>> abText(otherData, otherLabels, p2, 50, 1e-10);
+  AdaBoost<DecisionStump<>> abText(otherData, otherLabels, p2, 50, 1e-10);
 
-  AdaBoost<mat, DecisionStump<>> abXml, abBinary;
+  AdaBoost<DecisionStump<>> abXml, abBinary;
 
   SerializeObjectAll(ab, abXml, abText, abBinary);
 



More information about the mlpack-git mailing list