[mlpack] 55/207: Fix minor bugs with Classify() versions.

Barak A. Pearlmutter barak+git at pearlmutter.net
Thu Mar 23 17:53:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch master
in repository mlpack.

commit b6f29d70610a2472efb91b282e6350b1c9d96abb
Author: Ryan Curtin <ryan at ratml.org>
Date:   Tue Jan 24 11:14:13 2017 -0500

    Fix minor bugs with Classify() versions.
---
 src/mlpack/methods/decision_tree/decision_tree_impl.hpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/mlpack/methods/decision_tree/decision_tree_impl.hpp b/src/mlpack/methods/decision_tree/decision_tree_impl.hpp
index 78afddc..7e6ab1f 100644
--- a/src/mlpack/methods/decision_tree/decision_tree_impl.hpp
+++ b/src/mlpack/methods/decision_tree/decision_tree_impl.hpp
@@ -62,8 +62,8 @@ DecisionTree<FitnessFunction,
              CategoricalSplitType,
              ElemType,
              NoRecursion>::DecisionTree(const size_t numClasses) :
-    classProbabilities(numClasses),
-    dimensionTypeOrMajorityClass(0)
+    dimensionTypeOrMajorityClass(0),
+    classProbabilities(numClasses)
 {
   // Initialize utility vector.
   classProbabilities.fill(1.0 / (double) numClasses);
@@ -529,10 +529,13 @@ void DecisionTree<FitnessFunction,
   DecisionTree* node = children[0];
   while (node->NumChildren() != 0)
     node = &node->Child(0);
-  probabilities.set_size(node.classProbabilities.n_elem, data.n_cols);
+  probabilities.set_size(node->classProbabilities.n_elem, data.n_cols);
 
   for (size_t i = 0; i < data.n_cols; ++i)
-    Classify(data.col(i), predictions[i], probabilities.unsafe_col(i));
+  {
+    arma::vec v = probabilities.unsafe_col(i); // Alias of column.
+    Classify(data.col(i), predictions[i], v);
+  }
 }
 
 //! Serialize the tree.

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