[mlpack-svn] r16811 - in mlpack/trunk/src/mlpack/core/tree: binary_space_tree rectangle_tree
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Jul 10 10:31:37 EDT 2014
Author: rcurtin
Date: Thu Jul 10 10:31:37 2014
New Revision: 16811
Log:
Use the bound's cached MinWidth() for MinimumBoundDistance().
Modified:
mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
Modified: mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp (original)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp Thu Jul 10 10:31:37 2014
@@ -238,7 +238,6 @@
splitDimension(other.splitDimension),
parentDistance(other.parentDistance),
furthestDescendantDistance(other.furthestDescendantDistance),
- minimumBoundDistance(other.minimumBoundDistance),
dataset(other.dataset)
{
// Create left and right children (if any).
@@ -471,7 +470,7 @@
inline double BinarySpaceTree<BoundType, StatisticType, MatType, SplitType>::
MinimumBoundDistance() const
{
- return minimumBoundDistance;
+ return bound.MinWidth();
}
/**
@@ -572,15 +571,6 @@
// Calculate the furthest descendant distance.
furthestDescendantDistance = 0.5 * bound.Diameter();
- // Find the minimum distance to any bound edge.
- minimumBoundDistance = DBL_MAX;
- for (size_t i = 0; i < bound.Dim(); ++i)
- {
- const double dist = std::max(bound[i].Hi() - bound[i].Lo(), 0.0);
- if (dist < minimumBoundDistance)
- minimumBoundDistance = dist;
- }
-
// Now, check if we need to split at all.
if (count <= maxLeafSize)
return; // We can't split this.
@@ -637,15 +627,6 @@
// Calculate the furthest descendant distance.
furthestDescendantDistance = 0.5 * bound.Diameter();
- // Find the minimum distance to any bound edge.
- minimumBoundDistance = DBL_MAX;
- for (size_t i = 0; i < bound.Dim(); ++i)
- {
- const double dist = std::max(bound[i].Hi() - bound[i].Lo(), 0.0);
- if (dist < minimumBoundDistance)
- minimumBoundDistance = dist;
- }
-
// First, check if we need to split at all.
if (count <= maxLeafSize)
return; // We can't split this.
Modified: mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp (original)
+++ mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp Thu Jul 10 10:31:37 2014
@@ -268,7 +268,7 @@
//! Return the minimum distance from the center to any edge of the bound.
//! Currently, this returns 0, which doesn't break algorithms, but it isn't
//! necessarily correct, either.
- double MinimumBoundDistance() const { return 0.0; }
+ double MinimumBoundDistance() const { return bound.MinWidth(); }
//! Return the distance from the center of this node to the center of the
//! parent node.
More information about the mlpack-svn
mailing list