13 #ifndef MLPACK_METHODS_FASTMKS_FASTMKS_HPP 14 #define MLPACK_METHODS_FASTMKS_FASTMKS_HPP 57 typename MatType = arma::mat,
58 template<
typename TreeMetricType,
59 typename TreeStatType,
88 const bool naive =
false);
104 const bool naive =
false);
185 void Search(
const MatType& querySet,
187 arma::Mat<size_t>& indices,
212 void Search(Tree* querySet,
214 arma::Mat<size_t>& indices,
231 void Search(
const size_t k,
232 arma::Mat<size_t>& indices,
233 arma::mat& products);
251 template<
typename Archive>
252 void Serialize(Archive& ar,
const unsigned int );
280 return c1.first > c2.first;
285 typedef std::priority_queue<Candidate, std::vector<Candidate>,
293 #include "fastmks_impl.hpp" std::priority_queue< Candidate, std::vector< Candidate >, CandidateCmp > CandidateList
Use a priority queue to represent the list of candidate points.
bool treeOwner
If true, this object created the tree and is responsible for it.
void Train(const MatType &referenceSet)
"Train" the FastMKS model on the given reference set (this will just build a tree, if the current search mode is not naive mode).
bool & Naive()
Modify whether or not brute-force (naive) search is used.
Linear algebra utility functions, generally performed on matrices or vectors.
FastMKS & operator=(const FastMKS &other)
Assign this model to be a copy of the given model.
Compare two candidates based on the value.
The core includes that mlpack expects; standard C++ includes and Armadillo.
bool setOwner
If true, we own the dataset. This happens in only a few situations.
bool singleMode
If true, single-tree search is used.
bool & SingleMode()
Modify whether or not single-tree search is used.
bool Naive() const
Get whether or not brute-force (naive) search is used.
The inner product metric, IPMetric, takes a given Mercer kernel (KernelType), and when Evaluate() is ...
Tree * referenceTree
The tree built on the reference dataset.
FastMKS(const bool singleMode=false, const bool naive=false)
Create the FastMKS object with an empty reference set and default kernel.
~FastMKS()
Destructor for the FastMKS object.
const metric::IPMetric< KernelType > & Metric() const
Get the inner-product metric induced by the given kernel.
std::pair< double, size_t > Candidate
Candidate represents a possible candidate point (value, index).
metric::IPMetric< KernelType > & Metric()
Modify the inner-product metric induced by the given kernel.
bool SingleMode() const
Get whether or not single-tree search is used.
bool operator()(const Candidate &c1, const Candidate &c2)
The statistic used in trees with FastMKS.
TreeType< metric::IPMetric< KernelType >, FastMKSStat, MatType > Tree
Convenience typedef.
metric::IPMetric< KernelType > metric
The instantiated inner-product metric induced by the given kernel.
const MatType * referenceSet
The reference dataset.
void Search(const MatType &querySet, const size_t k, arma::Mat< size_t > &indices, arma::mat &kernels)
Search for the points in the reference set with maximum kernel evaluation to each point in the given ...
bool naive
If true, naive (brute-force) search is used.
An implementation of fast exact max-kernel search.
void Serialize(Archive &ar, const unsigned int)
Serialize the model.
A cover tree is a tree specifically designed to speed up nearest-neighbor computation in high-dimensi...