15 #ifndef __MLPACK_METHODS_FASTMKS_FASTMKS_HPP 16 #define __MLPACK_METHODS_FASTMKS_FASTMKS_HPP 59 typename MatType = arma::mat,
60 template<
typename TreeMetricType,
61 typename TreeStatType,
90 const bool naive =
false);
106 const bool naive =
false);
172 void Search(
const MatType& querySet,
174 arma::Mat<size_t>& indices,
199 void Search(Tree* querySet,
201 arma::Mat<size_t>& indices,
218 void Search(
const size_t k,
219 arma::Mat<size_t>& indices,
220 arma::mat& products);
238 template<
typename Archive>
239 void Serialize(Archive& ar,
const unsigned int );
263 const size_t queryIndex,
265 const size_t neighbor,
266 const double distance);
273 #include "fastmks_impl.hpp" 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.
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.
metric::IPMetric< KernelType > & Metric()
Modify the inner-product metric induced by the given kernel.
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
bool SingleMode() const
Get whether or not single-tree search is used.
void InsertNeighbor(arma::Mat< size_t > &indices, arma::mat &products, const size_t queryIndex, const size_t pos, const size_t neighbor, const double distance)
Utility function. Copied too many times from too many places.
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...