MLPACK  1.0.7
dtb_rules.hpp
Go to the documentation of this file.
1 
22 #ifndef __MLPACK_METHODS_EMST_DTB_RULES_HPP
23 #define __MLPACK_METHODS_EMST_DTB_RULES_HPP
24 
25 #include <mlpack/core.hpp>
26 
27 namespace mlpack {
28 namespace emst {
29 
30 template<typename MetricType, typename TreeType>
31 class DTBRules
32 {
33  public:
34  DTBRules(const arma::mat& dataSet,
36  arma::vec& neighborsDistances,
37  arma::Col<size_t>& neighborsInComponent,
38  arma::Col<size_t>& neighborsOutComponent,
39  MetricType& metric);
40 
41  double BaseCase(const size_t queryIndex, const size_t referenceIndex);
42 
51  double Score(const size_t queryIndex, TreeType& referenceNode);
52 
63  double Score(const size_t queryIndex,
64  TreeType& referenceNode,
65  const double baseCaseResult);
66 
78  double Rescore(const size_t queryIndex,
79  TreeType& referenceNode,
80  const double oldScore);
81 
90  double Score(TreeType& queryNode, TreeType& referenceNode) const;
91 
102  double Score(TreeType& queryNode,
103  TreeType& referenceNode,
104  const double baseCaseResult) const;
105 
117  double Rescore(TreeType& queryNode,
118  TreeType& referenceNode,
119  const double oldScore) const;
120 
121  private:
123  const arma::mat& dataSet;
124 
127 
129  arma::vec& neighborsDistances;
130 
133  arma::Col<size_t>& neighborsInComponent;
134 
137  arma::Col<size_t>& neighborsOutComponent;
138 
140  MetricType& metric;
141 
145  inline double CalculateBound(TreeType& queryNode) const;
146 
147 }; // class DTBRules
148 
149 } // emst namespace
150 } // mlpack namespace
151 
152 #include "dtb_rules_impl.hpp"
153 
154 #endif
A Union-Find data structure.
Definition: union_find.hpp:40
double CalculateBound(TreeType &queryNode) const
Update the bound for the given query node.
double BaseCase(const size_t queryIndex, const size_t referenceIndex)
arma::vec & neighborsDistances
The distance to the candidate nearest neighbor for each component.
Definition: dtb_rules.hpp:129
UnionFind & connections
Stores the tree structure so far.
Definition: dtb_rules.hpp:126
arma::Col< size_t > & neighborsInComponent
The index of the point in the component that is an endpoint of the candidate edge.
Definition: dtb_rules.hpp:133
DTBRules(const arma::mat &dataSet, UnionFind &connections, arma::vec &neighborsDistances, arma::Col< size_t > &neighborsInComponent, arma::Col< size_t > &neighborsOutComponent, MetricType &metric)
double Score(const size_t queryIndex, TreeType &referenceNode)
Get the score for recursion order.
MetricType & metric
The instantiated metric.
Definition: dtb_rules.hpp:140
const arma::mat & dataSet
The data points.
Definition: dtb_rules.hpp:123
arma::Col< size_t > & neighborsOutComponent
The index of the point outside of the component that is an endpoint of the candidate edge...
Definition: dtb_rules.hpp:137
double Rescore(const size_t queryIndex, TreeType &referenceNode, const double oldScore)
Re-evaluate the score for recursion order.