dtb_stat.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_EMST_DTB_STAT_HPP
13 #define MLPACK_METHODS_EMST_DTB_STAT_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace emst {
19 
24 class DTBStat
25 {
26  private:
29  double maxNeighborDistance;
30 
33  double minNeighborDistance;
34 
36  double bound;
37 
42  int componentMembership;
43 
44  public:
49  DTBStat() :
50  maxNeighborDistance(DBL_MAX),
51  minNeighborDistance(DBL_MAX),
52  bound(DBL_MAX),
53  componentMembership(-1) { }
54 
62  template<typename TreeType>
63  DTBStat(const TreeType& node) :
64  maxNeighborDistance(DBL_MAX),
65  minNeighborDistance(DBL_MAX),
66  bound(DBL_MAX),
67  componentMembership(
68  ((node.NumPoints() == 1) && (node.NumChildren() == 0)) ?
69  node.Point(0) : -1) { }
70 
72  double MaxNeighborDistance() const { return maxNeighborDistance; }
74  double& MaxNeighborDistance() { return maxNeighborDistance; }
75 
77  double MinNeighborDistance() const { return minNeighborDistance; }
79  double& MinNeighborDistance() { return minNeighborDistance; }
80 
82  double Bound() const { return bound; }
84  double& Bound() { return bound; }
85 
87  int ComponentMembership() const { return componentMembership; }
89  int& ComponentMembership() { return componentMembership; }
90 }; // class DTBStat
91 
92 } // namespace emst
93 } // namespace mlpack
94 
95 #endif // MLPACK_METHODS_EMST_DTB_STAT_HPP
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
DTBStat(const TreeType &node)
This is called when a node is finished initializing.
Definition: dtb_stat.hpp:63
double MinNeighborDistance() const
Get the minimum neighbor distance.
Definition: dtb_stat.hpp:77
double & MaxNeighborDistance()
Modify the maximum neighbor distance.
Definition: dtb_stat.hpp:74
DTBStat()
A generic initializer.
Definition: dtb_stat.hpp:49
int & ComponentMembership()
Modify the component membership of this node.
Definition: dtb_stat.hpp:89
int ComponentMembership() const
Get the component membership of this node.
Definition: dtb_stat.hpp:87
double MaxNeighborDistance() const
Get the maximum neighbor distance.
Definition: dtb_stat.hpp:72
double Bound() const
Get the total bound for pruning.
Definition: dtb_stat.hpp:82
A statistic for use with mlpack trees, which stores the upper bound on distance to nearest neighbors ...
Definition: dtb_stat.hpp:24
double & MinNeighborDistance()
Modify the minimum neighbor distance.
Definition: dtb_stat.hpp:79
double & Bound()
Modify the total bound for pruning.
Definition: dtb_stat.hpp:84