mlpack  3.4.2
r_plus_tree_split_policy.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_SPLIT_POLICY_HPP
15 #define MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_SPLIT_POLICY_HPP
16 
17 namespace mlpack {
18 namespace tree {
19 
26 {
27  public:
29  static const int SplitRequired = 0;
31  static const int AssignToFirstTree = 1;
33  static const int AssignToSecondTree = 2;
34 
47  template<typename TreeType>
48  static int GetSplitPolicy(const TreeType& child,
49  const size_t axis,
50  const typename TreeType::ElemType cut)
51  {
52  if (child.Bound()[axis].Hi() <= cut)
53  return AssignToFirstTree;
54  else if (child.Bound()[axis].Lo() >= cut)
55  return AssignToSecondTree;
56 
57  return SplitRequired;
58  }
59 
67  template<typename TreeType>
68  static const
70  Bound(const TreeType& node)
71  {
72  return node.Bound();
73  }
74 };
75 
76 } // namespace tree
77 } // namespace mlpack
78 
79 #endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_SPLIT_POLICY_HPP
mlpack::tree::RPlusTreeSplitPolicy::Bound
static const bound::HRectBound< metric::EuclideanDistance, typename TreeType::ElemType > & Bound(const TreeType &node)
Return the minimum bounding rectangle of the node.
Definition: r_plus_tree_split_policy.hpp:70
mlpack::tree::RPlusTreeSplitPolicy::AssignToFirstTree
static const int AssignToFirstTree
Indicate that the child should be inserted to the first subtree.
Definition: r_plus_tree_split_policy.hpp:31
mlpack::tree::RPlusTreeSplitPolicy::SplitRequired
static const int SplitRequired
Indicate that the child should be split.
Definition: r_plus_tree_split_policy.hpp:29
mlpack::tree::RPlusTreeSplitPolicy
The RPlusPlusTreeSplitPolicy helps to determine the subtree into which we should insert a child of an...
Definition: r_plus_tree_split_policy.hpp:26
mlpack::bound::HRectBound
Hyper-rectangle bound for an L-metric.
Definition: hrectbound.hpp:55
mlpack
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: add_to_cli11.hpp:21
mlpack::tree::RPlusTreeSplitPolicy::GetSplitPolicy
static int GetSplitPolicy(const TreeType &child, const size_t axis, const typename TreeType::ElemType cut)
This method returns SplitRequired if a child of an intermediate node should be split,...
Definition: r_plus_tree_split_policy.hpp:48
mlpack::tree::RPlusTreeSplitPolicy::AssignToSecondTree
static const int AssignToSecondTree
Indicate that the child should be inserted to the second subtree.
Definition: r_plus_tree_split_policy.hpp:33