[mlpack-git] master: Handle empty datasets. (fa45524)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Tue Sep 29 09:33:23 EDT 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/cbeb3ea17262b7c5115247dc217e316c529249b7...f85a9b22f3ce56143943a2488c05c2810d6b2bf3

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

commit fa45524053c8bf1b0c69a6c3645fef97f73f86af
Author: Ryan Curtin <ryan at ratml.org>
Date:   Fri Sep 25 16:28:40 2015 -0400

    Handle empty datasets.


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

fa45524053c8bf1b0c69a6c3645fef97f73f86af
 src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp b/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
index 92b1592..f75070e 100644
--- a/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
+++ b/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
@@ -586,7 +586,8 @@ void BinarySpaceTree<MetricType, StatisticType, MatType, BoundType, SplitType>::
               SplitType<BoundType<MetricType>, MatType>& splitter)
 {
   // We need to expand the bounds of this node properly.
-  bound |= dataset->cols(begin, begin + count - 1);
+  if (count > 0)
+    bound |= dataset->cols(begin, begin + count - 1);
 
   // Calculate the furthest descendant distance.
   furthestDescendantDistance = 0.5 * bound.Diameter();
@@ -643,7 +644,8 @@ SplitNode(std::vector<size_t>& oldFromNew,
 {
   // This should be a single function for Bound.
   // We need to expand the bounds of this node properly.
-  bound |= dataset->cols(begin, begin + count - 1);
+  if (count > 0)
+    bound |= dataset->cols(begin, begin + count - 1);
 
   // Calculate the furthest descendant distance.
   furthestDescendantDistance = 0.5 * bound.Diameter();



More information about the mlpack-git mailing list