[mlpack-git] master: Remove unnecessary BuildWeightMatrix(). (907420a)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Mon Nov 30 21:32:41 EST 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/31c557d9cc7e4da57fd8a246085c19e076d12271...abd5fdc7f7ce73f10e983fac3749505bd67871d6

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

commit 907420a2799249a1cb11f07d399cdb817ef356c7
Author: Ryan Curtin <ryan at ratml.org>
Date:   Tue Dec 1 01:26:58 2015 +0000

    Remove unnecessary BuildWeightMatrix().


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

907420a2799249a1cb11f07d399cdb817ef356c7
 src/mlpack/methods/adaboost/adaboost.hpp      | 11 -----------
 src/mlpack/methods/adaboost/adaboost_impl.hpp | 19 +------------------
 2 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/src/mlpack/methods/adaboost/adaboost.hpp b/src/mlpack/methods/adaboost/adaboost.hpp
index 0623762..f538897 100644
--- a/src/mlpack/methods/adaboost/adaboost.hpp
+++ b/src/mlpack/methods/adaboost/adaboost.hpp
@@ -132,17 +132,6 @@ class AdaBoost
   void Classify(const MatType& test, arma::Row<size_t>& predictedLabels);
 
 private:
-  /**
-   * This function helps in building the Weight Distribution matrix which is
-   * updated during every iteration. It calculates the "difficulty" in
-   * classifying a point by adding the weights for all instances, using D.
-   *
-   * @param D The 2 Dimensional weight matrix from which the weights are
-   *     to be calculated.
-   * @param weights The output weight vector.
-   */
-  void BuildWeightMatrix(const arma::mat& D, arma::rowvec& weights);
-
   //! The number of classes in the model.
   size_t classes;
   // The tolerance for change in rt and when to stop.
diff --git a/src/mlpack/methods/adaboost/adaboost_impl.hpp b/src/mlpack/methods/adaboost/adaboost_impl.hpp
index 2a3f53d..6fddfe7 100644
--- a/src/mlpack/methods/adaboost/adaboost_impl.hpp
+++ b/src/mlpack/methods/adaboost/adaboost_impl.hpp
@@ -101,7 +101,7 @@ void AdaBoost<MatType, WeakLearner>::Train(
     zt = 0.0;
 
     // Build the weight vectors.
-    BuildWeightMatrix(D, weights);
+    weights = arma::sum(D, 1).t();
 
     // Use the existing weak learner to train a new one with new weights.
     WeakLearner w(other, tempData, labels, weights);
@@ -226,23 +226,6 @@ void AdaBoost<MatType, WeakLearner>::Classify(
   }
 }
 
-/**
- * This function helps in building the Weight Distribution matrix which is
- * updated during every iteration. It calculates the "difficulty" in classifying
- * a point by adding the weights for all instances, using D.
- *
- * @param D The 2 Dimensional weight matrix from which the weights are
- *      to be calculated.
- * @param weights The output weight vector.
- */
-template <typename MatType, typename WeakLearner>
-void AdaBoost<MatType, WeakLearner>::BuildWeightMatrix(
-    const arma::mat& D,
-    arma::rowvec& weights)
-{
-  weights = arma::sum(D, 1).t();
-}
-
 } // namespace adaboost
 } // namespace mlpack
 



More information about the mlpack-git mailing list