[mlpack-git] master: Fix -Wuninitialized. (67314c1)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Wed Dec 23 11:43:58 EST 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/de9cc4b05069e1fa4793d9355f2f595af5ff45d2...6070527af14296cd99739de6c62666cc5d2a2125

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

commit 67314c1242d8a58cad8e407566a1a32b590c91ad
Author: ryan <ryan at ratml.org>
Date:   Thu Oct 1 22:21:30 2015 -0400

    Fix -Wuninitialized.


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

67314c1242d8a58cad8e407566a1a32b590c91ad
 .../methods/hoeffding_trees/hoeffding_categorical_split_impl.hpp      | 4 ++--
 src/mlpack/methods/hoeffding_trees/hoeffding_numeric_split_impl.hpp   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mlpack/methods/hoeffding_trees/hoeffding_categorical_split_impl.hpp b/src/mlpack/methods/hoeffding_trees/hoeffding_categorical_split_impl.hpp
index b3200db..d93e3ac 100644
--- a/src/mlpack/methods/hoeffding_trees/hoeffding_categorical_split_impl.hpp
+++ b/src/mlpack/methods/hoeffding_trees/hoeffding_categorical_split_impl.hpp
@@ -49,7 +49,7 @@ void HoeffdingCategoricalSplit<FitnessFunction>::Split(
   childMajorities.set_size(sufficientStatistics.n_cols);
   for (size_t i = 0; i < sufficientStatistics.n_cols; ++i)
   {
-    arma::uword maxIndex;
+    arma::uword maxIndex = 0;
     sufficientStatistics.unsafe_col(i).max(maxIndex);
     childMajorities[i] = size_t(maxIndex);
   }
@@ -64,7 +64,7 @@ size_t HoeffdingCategoricalSplit<FitnessFunction>::MajorityClass() const
   // Calculate the class that we have seen the most of.
   arma::Col<size_t> classCounts = arma::sum(sufficientStatistics, 1);
 
-  arma::uword maxIndex;
+  arma::uword maxIndex = 0;
   classCounts.max(maxIndex);
 
   return size_t(maxIndex);
diff --git a/src/mlpack/methods/hoeffding_trees/hoeffding_numeric_split_impl.hpp b/src/mlpack/methods/hoeffding_trees/hoeffding_numeric_split_impl.hpp
index 1c7bc6e..6809dd9 100644
--- a/src/mlpack/methods/hoeffding_trees/hoeffding_numeric_split_impl.hpp
+++ b/src/mlpack/methods/hoeffding_trees/hoeffding_numeric_split_impl.hpp
@@ -100,7 +100,7 @@ void HoeffdingNumericSplit<FitnessFunction, ObservationType>::Split(
   childMajorities.set_size(sufficientStatistics.n_cols);
   for (size_t i = 0; i < sufficientStatistics.n_cols; ++i)
   {
-    arma::uword maxIndex;
+    arma::uword maxIndex = 0;
     sufficientStatistics.unsafe_col(i).max(maxIndex);
     childMajorities[i] = size_t(maxIndex);
   }
@@ -132,7 +132,7 @@ size_t HoeffdingNumericSplit<FitnessFunction, ObservationType>::
     // statistics.
     arma::Col<size_t> classCounts = arma::sum(sufficientStatistics, 1);
 
-    arma::uword maxIndex;
+    arma::uword maxIndex = 0;
     classCounts.max(maxIndex);
     return size_t(maxIndex);
   }



More information about the mlpack-git mailing list