[mlpack] 300/324: Add some const and fix some formatting.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:22:20 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 4d2499d88700ffdbae82a90fbbdb9ad849d4c87b
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Thu Aug 7 15:14:05 2014 +0000

    Add some const and fix some formatting.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16984 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/methods/adaboost/adaboost.hpp      | 25 ++++++++++++++-----------
 src/mlpack/methods/adaboost/adaboost_impl.hpp | 14 +++++++++-----
 2 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/src/mlpack/methods/adaboost/adaboost.hpp b/src/mlpack/methods/adaboost/adaboost.hpp
index 838a61c..4f0ef30 100644
--- a/src/mlpack/methods/adaboost/adaboost.hpp
+++ b/src/mlpack/methods/adaboost/adaboost.hpp
@@ -30,22 +30,25 @@
 namespace mlpack {
 namespace adaboost {
 
-template <typename MatType = arma::mat, typename WeakLearner =
-          mlpack::perceptron::Perceptron<> >
+template<typename MatType = arma::mat,
+         typename WeakLearner = mlpack::perceptron::Perceptron<> >
 class Adaboost
 {
-public:
+ public:
   /**
-   *  Constructor. Currently runs the Adaboost.mh algorithm
+   * Constructor. Currently runs the Adaboost.mh algorithm.
    *
-   *  @param data Input data
-   *  @param labels Corresponding labels
-   *  @param iterations Number of boosting rounds
-   *  @param tol The tolerance for change in values of rt.
-   *  @param other Weak Learner, which has been initialized already
+   * @param data Input data.
+   * @param labels Corresponding labels.
+   * @param iterations Number of boosting rounds.
+   * @param tol The tolerance for change in values of rt.
+   * @param other Weak Learner, which has been initialized already.
    */
-  Adaboost(const MatType& data, const arma::Row<size_t>& labels,
-           int iterations, double tol, const WeakLearner& other);
+  Adaboost(const MatType& data,
+           const arma::Row<size_t>& labels,
+           const int iterations,
+           const double tol,
+           const WeakLearner& other);
 
   /**
    *  This function helps in building a classification Matrix which is of
diff --git a/src/mlpack/methods/adaboost/adaboost_impl.hpp b/src/mlpack/methods/adaboost/adaboost_impl.hpp
index 8c51441..139b9d8 100644
--- a/src/mlpack/methods/adaboost/adaboost_impl.hpp
+++ b/src/mlpack/methods/adaboost/adaboost_impl.hpp
@@ -25,6 +25,7 @@
 
 namespace mlpack {
 namespace adaboost {
+
 /**
  *  Constructor. Currently runs the Adaboost.mh algorithm
  *
@@ -34,12 +35,15 @@ namespace adaboost {
  *  @param other Weak Learner, which has been initialized already
  */
 template<typename MatType, typename WeakLearner>
-Adaboost<MatType, WeakLearner>::Adaboost(const MatType& data,
-        const arma::Row<size_t>& labels, int iterations, double tol,
-        const WeakLearner& other)
+Adaboost<MatType, WeakLearner>::Adaboost(
+    const MatType& data,
+    const arma::Row<size_t>& labels,
+    const int iterations,
+    const double tol,
+    const WeakLearner& other)
 {
-  // Counting the number of classes into numClasses.
-  size_t numClasses = (arma::max(labels) - arma::min(labels)) + 1;
+  // Count the number of classes.
+  const size_t numClasses = (arma::max(labels) - arma::min(labels)) + 1;
   tolerance = tol;
   int i, j, k;
   double rt, crt, alphat = 0.0, zt;

-- 
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