dual_tree_kmeans_rules.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_METHODS_KMEANS_DUAL_TREE_KMEANS_RULES_HPP
15 #define MLPACK_METHODS_KMEANS_DUAL_TREE_KMEANS_RULES_HPP
16 
18 
19 namespace mlpack {
20 namespace kmeans {
21 
22 template<typename MetricType, typename TreeType>
24 {
25  public:
26  DualTreeKMeansRules(const arma::mat& centroids,
27  const arma::mat& dataset,
28  arma::Row<size_t>& assignments,
29  arma::vec& upperBounds,
30  arma::vec& lowerBounds,
31  MetricType& metric,
32  const std::vector<bool>& prunedPoints,
33  const std::vector<size_t>& oldFromNewCentroids,
34  std::vector<bool>& visited);
35 
36  double BaseCase(const size_t queryIndex, const size_t referenceIndex);
37 
38  double Score(const size_t queryIndex, TreeType& referenceNode);
39  double Score(TreeType& queryNode, TreeType& referenceNode);
40  double Rescore(const size_t queryIndex,
41  TreeType& referenceNode,
42  const double oldScore);
43  double Rescore(TreeType& queryNode,
44  TreeType& referenceNode,
45  const double oldScore);
46 
48 
49  TraversalInfoType& TraversalInfo() { return traversalInfo; }
50  const TraversalInfoType& TraversalInfo() const { return traversalInfo; }
51 
52  size_t BaseCases() const { return baseCases; }
53  size_t& BaseCases() { return baseCases; }
54 
55  size_t Scores() const { return scores; }
56  size_t& Scores() { return scores; }
57 
58  private:
59  const arma::mat& centroids;
60  const arma::mat& dataset;
61  arma::Row<size_t>& assignments;
62  arma::vec& upperBounds;
63  arma::vec& lowerBounds;
64  MetricType& metric;
65 
66  const std::vector<bool>& prunedPoints;
67 
68  const std::vector<size_t>& oldFromNewCentroids;
69 
70  std::vector<bool>& visited;
71 
72  size_t baseCases;
73  size_t scores;
74 
75  TraversalInfoType traversalInfo;
76 
77  size_t lastQueryIndex;
78  size_t lastReferenceIndex;
79  size_t lastBaseCase;
80 };
81 
82 } // namespace kmeans
83 } // namespace mlpack
84 
85 #include "dual_tree_kmeans_rules_impl.hpp"
86 
87 #endif
The TraversalInfo class holds traversal information which is used in dual-tree (and single-tree) trav...
.hpp
Definition: add_to_po.hpp:21
const TraversalInfoType & TraversalInfo() const
double Score(const size_t queryIndex, TreeType &referenceNode)
DualTreeKMeansRules(const arma::mat &centroids, const arma::mat &dataset, arma::Row< size_t > &assignments, arma::vec &upperBounds, arma::vec &lowerBounds, MetricType &metric, const std::vector< bool > &prunedPoints, const std::vector< size_t > &oldFromNewCentroids, std::vector< bool > &visited)
double Rescore(const size_t queryIndex, TreeType &referenceNode, const double oldScore)
double BaseCase(const size_t queryIndex, const size_t referenceIndex)
tree::TraversalInfo< TreeType > TraversalInfoType