14 #ifndef MLPACK_METHODS_KMEANS_DUAL_TREE_KMEANS_RULES_HPP 15 #define MLPACK_METHODS_KMEANS_DUAL_TREE_KMEANS_RULES_HPP 22 template<
typename MetricType,
typename TreeType>
27 const arma::mat& dataset,
28 arma::Row<size_t>& assignments,
29 arma::vec& upperBounds,
30 arma::vec& lowerBounds,
32 const std::vector<bool>& prunedPoints,
33 const std::vector<size_t>& oldFromNewCentroids,
34 std::vector<bool>& visited);
36 double BaseCase(
const size_t queryIndex,
const size_t referenceIndex);
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);
50 const TraversalInfoType&
TraversalInfo()
const {
return traversalInfo; }
55 size_t Scores()
const {
return scores; }
63 const arma::mat& centroids;
64 const arma::mat& dataset;
65 arma::Row<size_t>& assignments;
66 arma::vec& upperBounds;
67 arma::vec& lowerBounds;
70 const std::vector<bool>& prunedPoints;
72 const std::vector<size_t>& oldFromNewCentroids;
74 std::vector<bool>& visited;
79 TraversalInfoType traversalInfo;
81 size_t lastQueryIndex;
82 size_t lastReferenceIndex;
89 #include "dual_tree_kmeans_rules_impl.hpp"
The TraversalInfo class holds traversal information which is used in dual-tree (and single-tree) trav...
Linear algebra utility functions, generally performed on matrices or vectors.
const TraversalInfoType & TraversalInfo() const
double Score(const size_t queryIndex, TreeType &referenceNode)
TraversalInfoType & TraversalInfo()
DualTreeKMeansRules(const arma::mat ¢roids, 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)
size_t MinimumBaseCases() const
Get the minimum number of base cases needed for correct results for each query point.
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