[mlpack-git] master: Fix TreeTrait for BallTree. (208f201)

gitdub at mlpack.org gitdub at mlpack.org
Tue Jul 19 09:09:49 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/8900b8ca1591c68aee93b462afabfc4be0e7e83b...f21439c2b65c273a541d3052cdd790464045b737

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

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

    Fix TreeTrait for BallTree.


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

208f20174ea89e9a053faf791bc45828cdb0b838
 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 f607ca5..9a81673 100644
--- a/src/mlpack/core/tree/binary_space_tree/traits.hpp
+++ b/src/mlpack/core/tree/binary_space_tree/traits.hpp
@@ -8,6 +8,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 {
@@ -56,6 +57,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