mlpack  2.0.1
dtb_stat.hpp
Go to the documentation of this file.
1 
14 #ifndef __MLPACK_METHODS_EMST_DTB_STAT_HPP
15 #define __MLPACK_METHODS_EMST_DTB_STAT_HPP
16 
17 #include <mlpack/core.hpp>
18 
19 namespace mlpack {
20 namespace emst {
21 
26 class DTBStat
27 {
28  private:
32 
36 
38  double bound;
39 
45 
46  public:
51  DTBStat() :
52  maxNeighborDistance(DBL_MAX),
53  minNeighborDistance(DBL_MAX),
54  bound(DBL_MAX),
55  componentMembership(-1) { }
56 
64  template<typename TreeType>
65  DTBStat(const TreeType& node) :
66  maxNeighborDistance(DBL_MAX),
67  minNeighborDistance(DBL_MAX),
68  bound(DBL_MAX),
69  componentMembership(
70  ((node.NumPoints() == 1) && (node.NumChildren() == 0)) ?
71  node.Point(0) : -1) { }
72 
74  double MaxNeighborDistance() const { return maxNeighborDistance; }
77 
79  double MinNeighborDistance() const { return minNeighborDistance; }
82 
84  double Bound() const { return bound; }
86  double& Bound() { return bound; }
87 
89  int ComponentMembership() const { return componentMembership; }
92 
93 }; // class DTBStat
94 
95 } // namespace emst
96 } // namespace mlpack
97 
98 #endif // __MLPACK_METHODS_EMST_DTB_STAT_HPP
double minNeighborDistance
Lower bound on the distance to the nearest neighbor of any point in this node.
Definition: dtb_stat.hpp:35
double MaxNeighborDistance() const
Get the maximum neighbor distance.
Definition: dtb_stat.hpp:74
double & Bound()
Modify the total bound for pruning.
Definition: dtb_stat.hpp:86
Linear algebra utility functions, generally performed on matrices or vectors.
int componentMembership
The index of the component that all points in this node belong to.
Definition: dtb_stat.hpp:44
double & MaxNeighborDistance()
Modify the maximum neighbor distance.
Definition: dtb_stat.hpp:76
DTBStat()
A generic initializer.
Definition: dtb_stat.hpp:51
int ComponentMembership() const
Get the component membership of this node.
Definition: dtb_stat.hpp:89
double maxNeighborDistance
Upper bound on the distance to the nearest neighbor of any point in this node.
Definition: dtb_stat.hpp:31
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
double MinNeighborDistance() const
Get the minimum neighbor distance.
Definition: dtb_stat.hpp:79
int & ComponentMembership()
Modify the component membership of this node.
Definition: dtb_stat.hpp:91
double bound
Total bound for pruning.
Definition: dtb_stat.hpp:38
double & MinNeighborDistance()
Modify the minimum neighbor distance.
Definition: dtb_stat.hpp:81
A statistic for use with mlpack trees, which stores the upper bound on distance to nearest neighbors ...
Definition: dtb_stat.hpp:26
DTBStat(const TreeType &node)
This is called when a node is finished initializing.
Definition: dtb_stat.hpp:65
double Bound() const
Get the total bound for pruning.
Definition: dtb_stat.hpp:84