[mlpack-git] mlpack-2.0.x: Fix TreeTrait for BallTree. (58523f0)

gitdub at mlpack.org gitdub at mlpack.org
Wed Jul 20 15:46:09 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : mlpack-2.0.x
Link       : https://github.com/mlpack/mlpack/compare/e434bc4ac042534529a2a440a44d86935b4d7164...fc4195d27bb9e642356a384d1fa6fe10cbdf89a6

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

commit 58523f0c4bc78e110ca337b9e6014407f40e2611
Author: MarcosPividori <marcos.pividori at gmail.com>
Date:   Tue Jul 19 10:09:49 2016 -0300

    Fix TreeTrait for BallTree.


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

58523f0c4bc78e110ca337b9e6014407f40e2611
 src/mlpack/core/tree/binary_space_tree/traits.hpp | 24 +++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/mlpack/core/tree/binary_space_tree/traits.hpp b/src/mlpack/core/tree/binary_space_tree/traits.hpp
index 2a1dc21..ced4aea 100644
--- a/src/mlpack/core/tree/binary_space_tree/traits.hpp
+++ b/src/mlpack/core/tree/binary_space_tree/traits.hpp
@@ -15,6 +15,7 @@
 #define MLPACK_CORE_TREE_BINARY_SPACE_TREE_TRAITS_HPP
 
 #include <mlpack/core/tree/tree_traits.hpp>
+#include <mlpack/core/tree/ballbound.hpp>
 
 namespace mlpack {
 namespace tree {
@@ -63,6 +64,29 @@ class TreeTraits<BinarySpaceTree<MetricType, StatisticType, MatType, BoundType,
   static const bool BinaryTree = true;
 };
 
+/**
+ * This is a specialization of the TreeType class to the BallTree tree type.
+ * The only difference with general BinarySpaceTree is that BallTree can have
+ * overlapping children.
+ * See mlpack/core/tree/tree_traits.hpp for more information.
+ */
+template<typename MetricType,
+         typename StatisticType,
+         typename MatType,
+         template<typename SplitBoundType, typename SplitMatType>
+             class SplitType>
+class TreeTraits<BinarySpaceTree<MetricType, StatisticType, MatType,
+    bound::BallBound, SplitType>>
+{
+ public:
+  static const bool HasOverlappingChildren = true;
+  static const bool HasDuplicatedPoints = false;
+  static const bool FirstPointIsCentroid = false;
+  static const bool HasSelfChildren = false;
+  static const bool RearrangesDataset = true;
+  static const bool BinaryTree = true;
+};
+
 } // namespace tree
 } // namespace mlpack
 




More information about the mlpack-git mailing list