MLPACK  1.0.11
example_tree.hpp
Go to the documentation of this file.
1 
24 #ifndef __MLPACK_CORE_TREE_EXAMPLE_TREE_HPP
25 #define __MLPACK_CORE_TREE_EXAMPLE_TREE_HPP
26 
27 namespace mlpack {
28 namespace tree {
29 
63 template<typename MetricType = metric::LMetric<2, true>,
64  typename StatisticType = EmptyStatistic,
65  typename MatType = arma::mat>
67 {
68  public:
89  ExampleTree(const MatType& dataset,
90  MetricType& metric);
91 
93  size_t NumChildren() const;
94 
96  const ExampleTree& Child(const size_t i) const;
98  ExampleTree& Child(const size_t i);
99 
101  ExampleTree* Parent() const;
102 
104  size_t NumPoints() const;
105 
116  size_t Point(const size_t i) const;
117 
125  size_t NumDescendants() const;
126 
133  size_t Descendant(const size_t i) const;
134 
136  const StatisticType& Stat() const;
138  StatisticType& Stat();
139 
141  const MetricType& Metric() const;
143  MetricType& Metric();
144 
153  double MinDistance(const MatType& point) const;
154 
163  double MinDistance(const ExampleTree& other) const;
164 
173  double MaxDistance(const MatType& point) const;
174 
183  double MaxDistance(const ExampleTree& other) const;
184 
196  math::Range RangeDistance(const MatType& point) const;
197 
209  math::Range RangeDistance(const ExampleTree& other) const;
210 
216  void Centroid(arma::vec& centroid) const;
217 
224  double FurthestDescendantDistance() const;
225 
230  double ParentDistance() const;
231 
232  private:
235  StatisticType stat;
236 
244  MetricType& metric;
245 };
246 
247 }; // namespace tree
248 }; // namespace mlpack
249 
250 #endif