traits.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_CORE_TREE_BINARY_SPACE_TREE_TRAITS_HPP
13 #define MLPACK_CORE_TREE_BINARY_SPACE_TREE_TRAITS_HPP
14 
17 
18 namespace mlpack {
19 namespace tree {
20 
27 template<typename MetricType,
28  typename StatisticType,
29  typename MatType,
30  template<typename BoundMetricType, typename...> class BoundType,
31  template<typename SplitBoundType, typename SplitMatType>
32  class SplitType>
33 class TreeTraits<BinarySpaceTree<MetricType, StatisticType, MatType, BoundType,
34  SplitType>>
35 {
36  public:
42  static const bool HasOverlappingChildren = false;
43 
47  static const bool HasDuplicatedPoints = false;
48 
52  static const bool FirstPointIsCentroid = false;
53 
57  static const bool HasSelfChildren = false;
58 
62  static const bool RearrangesDataset = true;
63 
67  static const bool BinaryTree = true;
68 
73  static const bool UniqueNumDescendants = true;
74 };
75 
81 template<typename MetricType,
82  typename StatisticType,
83  typename MatType,
84  template<typename BoundMetricType, typename...> class BoundType>
85 class TreeTraits<BinarySpaceTree<MetricType, StatisticType, MatType, BoundType,
87 {
88  public:
92  static const bool HasOverlappingChildren = true;
93 
97  static const bool HasDuplicatedPoints = false;
98 
102  static const bool FirstPointIsCentroid = false;
103 
107  static const bool HasSelfChildren = false;
108 
112  static const bool RearrangesDataset = true;
113 
117  static const bool BinaryTree = true;
118 
123  static const bool UniqueNumDescendants = true;
124 };
125 
131 template<typename MetricType,
132  typename StatisticType,
133  typename MatType,
134  template<typename BoundMetricType, typename...> class BoundType>
135 class TreeTraits<BinarySpaceTree<MetricType, StatisticType, MatType, BoundType,
137 {
138  public:
142  static const bool HasOverlappingChildren = true;
143 
147  static const bool HasDuplicatedPoints = false;
148 
152  static const bool FirstPointIsCentroid = false;
153 
157  static const bool HasSelfChildren = false;
158 
162  static const bool RearrangesDataset = true;
163 
167  static const bool BinaryTree = true;
168 
173  static const bool UniqueNumDescendants = true;
174 };
175 
182 template<typename MetricType,
183  typename StatisticType,
184  typename MatType,
185  template<typename SplitBoundType, typename SplitMatType>
186  class SplitType>
187 class TreeTraits<BinarySpaceTree<MetricType, StatisticType, MatType,
188  bound::BallBound, SplitType>>
189 {
190  public:
191  static const bool HasOverlappingChildren = true;
192  static const bool HasDuplicatedPoints = false;
193  static const bool FirstPointIsCentroid = false;
194  static const bool HasSelfChildren = false;
195  static const bool RearrangesDataset = true;
196  static const bool BinaryTree = true;
197  static const bool UniqueNumDescendants = true;
198 };
199 
206 template<typename MetricType,
207  typename StatisticType,
208  typename MatType,
209  template<typename SplitBoundType, typename SplitMatType>
210  class SplitType>
211 class TreeTraits<BinarySpaceTree<MetricType, StatisticType, MatType,
212  bound::HollowBallBound, SplitType>>
213 {
214  public:
215  static const bool HasOverlappingChildren = true;
216  static const bool HasDuplicatedPoints = false;
217  static const bool FirstPointIsCentroid = false;
218  static const bool HasSelfChildren = false;
219  static const bool RearrangesDataset = true;
220  static const bool BinaryTree = true;
221  static const bool UniqueNumDescendants = true;
222 };
223 
230 template<typename MetricType,
231  typename StatisticType,
232  typename MatType,
233  template<typename SplitBoundType, typename SplitMatType>
234  class SplitType>
235 class TreeTraits<BinarySpaceTree<MetricType, StatisticType, MatType,
236  bound::CellBound, SplitType>>
237 {
238  public:
239  static const bool HasOverlappingChildren = true;
240  static const bool HasDuplicatedPoints = false;
241  static const bool FirstPointIsCentroid = false;
242  static const bool HasSelfChildren = false;
243  static const bool RearrangesDataset = true;
244  static const bool BinaryTree = true;
245  static const bool UniqueNumDescendants = true;
246 };
247 
248 } // namespace tree
249 } // namespace mlpack
250 
251 #endif
.hpp
Definition: add_to_po.hpp:21
static const bool BinaryTree
This is true if the tree always has only two children.
This class splits a node by a random hyperplane.
A binary space partitioning tree, such as a KD-tree or a ball tree.
static const bool HasSelfChildren
This is true if the points contained in the first child of a node (Child(0)) are also contained in th...
static const bool RearrangesDataset
This is true if the tree rearranges points in the dataset when it is built.
static const bool HasDuplicatedPoints
This is true if a point can be included in more than one node.
Definition: tree_traits.hpp:89
This class splits a binary space tree.
static const bool FirstPointIsCentroid
This is true if the first point of each node is the centroid of its bound.
Definition: tree_traits.hpp:94
Bounds that are useful for binary space partitioning trees.
The TreeTraits class provides compile-time information on the characteristics of a given tree type...
Definition: tree_traits.hpp:77
static const bool HasOverlappingChildren
This is true if the subspaces represented by the children of a node can overlap.
Definition: tree_traits.hpp:84
static const bool UniqueNumDescendants
This is true if the NumDescendants() method doesn&#39;t include duplicated points.