[mlpack-svn] r16984 - mlpack/trunk/src/mlpack/methods/adaboost

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Aug 7 11:14:05 EDT 2014


Author: rcurtin
Date: Thu Aug  7 11:14:05 2014
New Revision: 16984

Log:
Add some const and fix some formatting.


Modified:
   mlpack/trunk/src/mlpack/methods/adaboost/adaboost.hpp
   mlpack/trunk/src/mlpack/methods/adaboost/adaboost_impl.hpp

Modified: mlpack/trunk/src/mlpack/methods/adaboost/adaboost.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/adaboost/adaboost.hpp	(original)
+++ mlpack/trunk/src/mlpack/methods/adaboost/adaboost.hpp	Thu Aug  7 11:14:05 2014
@@ -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

Modified: mlpack/trunk/src/mlpack/methods/adaboost/adaboost_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/adaboost/adaboost_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/methods/adaboost/adaboost_impl.hpp	Thu Aug  7 11:14:05 2014
@@ -25,6 +25,7 @@
 
 namespace mlpack {
 namespace adaboost {
+
 /**
  *  Constructor. Currently runs the Adaboost.mh algorithm
  *
@@ -34,12 +35,15 @@
  *  @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;



More information about the mlpack-svn mailing list