[mlpack-svn] r13956 - mlpack/trunk/src/mlpack/core/tree/binary_space_tree

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Nov 29 19:10:00 EST 2012


Author: rcurtin
Date: 2012-11-29 19:09:59 -0500 (Thu, 29 Nov 2012)
New Revision: 13956

Modified:
   mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp
   mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
Log:
Add a method to get the furthest descendant distance.


Modified: mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp	2012-11-29 23:55:59 UTC (rev 13955)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp	2012-11-30 00:09:59 UTC (rev 13956)
@@ -249,6 +249,15 @@
   size_t NumChildren() const;
 
   /**
+   * Return the furthest possible descendant distance.  This returns the maximum
+   * distance from the centroid to the edge of the bound and not the empirical
+   * quantity which is the actual furthest descendant distance.  So the actual
+   * furthest descendant distance may be less than what this method returns (but
+   * it will never be greater than this).
+   */
+  double FurthestDescendantDistance() const;
+
+  /**
    * Return the specified child (0 will be left, 1 will be right).  If the index
    * is greater than 1, this will return the right child.
    *

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	2012-11-29 23:55:59 UTC (rev 13955)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp	2012-11-30 00:09:59 UTC (rev 13956)
@@ -400,6 +400,22 @@
 }
 
 /**
+ * Return the furthest possible descendant distance.  This returns the maximum
+ * distance from the centroid to the edge of the bound and not the empirical
+ * quantity which is the actual furthest descendant distance.  So the actual
+ * furthest descendant distance may be less than what this method returns (but
+ * it will never be greater than this).
+ */
+template<typename BoundType, typename StatisticType, typename MatType>
+inline double BinarySpaceTree<BoundType, StatisticType, MatType>::
+    FurthestDescendantDistance() const
+{
+  arma::vec centroid;
+  bound.Centroid(centroid);
+  return bound.MaxDistance(centroid);
+}
+
+/**
  * Return the specified child.
  */
 template<typename BoundType, typename StatisticType, typename MatType>




More information about the mlpack-svn mailing list