[mlpack] 158/324: Const-correctness and 80-character lines... very trivial fix, no functionality change.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:22:06 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 db5c21a7cb83102cb9c0d6ea19f2df3978d807ff
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Wed Jul 9 19:25:51 2014 +0000

    Const-correctness and 80-character lines... very trivial fix, no functionality
    change.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16797 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 .../methods/decision_stump/decision_stump_impl.hpp      | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/mlpack/methods/decision_stump/decision_stump_impl.hpp b/src/mlpack/methods/decision_stump/decision_stump_impl.hpp
index e30168f..cfe4388 100644
--- a/src/mlpack/methods/decision_stump/decision_stump_impl.hpp
+++ b/src/mlpack/methods/decision_stump/decision_stump_impl.hpp
@@ -37,9 +37,9 @@ DecisionStump<MatType>::DecisionStump(const MatType& data,
   // If classLabels are not all identical, proceed with training.
   int bestAtt = 0;
   double entropy;
-  double rootEntropy = CalculateEntropy<size_t>(labels.subvec(0,labels.n_elem-1));
-  // std::cout<<"rootEntropy is: "<<rootEntropy<<"\n";
-  // double bestEntropy = DBL_MAX;
+  const double rootEntropy = CalculateEntropy<size_t>(
+      labels.subvec(0, labels.n_elem - 1));
+
   double gain, bestGain = 0.0;
   for (int i = 0; i < data.n_rows; i++)
   {
@@ -56,12 +56,11 @@ DecisionStump<MatType>::DecisionStump(const MatType& data,
       // maximized.
 
       // if (entropy < bestEntropy)
-      // Instead of the above rule, we are maximizing gain, which was 
+      // Instead of the above rule, we are maximizing gain, which was
       // what is returned from SetupSplitAttribute.
       if (gain < bestGain)
       {
         bestAtt = i;
-        // bestEntropy = entropy;
         bestGain = gain;
       }
     }
@@ -372,8 +371,8 @@ double DecisionStump<MatType>::CalculateEntropy(arma::subview_row<LabelType> lab
 {
   double entropy = 0.0;
   size_t j;
-  
-  arma::Row<size_t> numElem(numClass); 
+
+  arma::Row<size_t> numElem(numClass);
   numElem.fill(0);
 
   // Populate numElem; they are used as helpers to calculate
@@ -384,10 +383,10 @@ double DecisionStump<MatType>::CalculateEntropy(arma::subview_row<LabelType> lab
   for (j = 0; j < numClass; j++)
   {
     const double p1 = ((double) numElem(j) / labels.n_elem);
-  
+
     entropy += (p1 == 0) ? 0 : p1 * log2(p1);
   }
-  
+
   return entropy;
 }
 

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