mlpack 3.4.2
fastmks_model.hpp
Go to the documentation of this file.
1
12#ifndef MLPACK_METHODS_FASTMKS_FASTMKS_MODEL_HPP
13#define MLPACK_METHODS_FASTMKS_FASTMKS_MODEL_HPP
14
15#include <mlpack/prereqs.hpp>
16#include "fastmks.hpp"
28
29namespace mlpack {
30namespace fastmks {
31
35{
36 public:
39 {
47 };
48
52 FastMKSModel(const int kernelType = LINEAR_KERNEL);
53
56
59
62
67
72 template<typename TKernelType>
73 void BuildModel(arma::mat&& referenceData,
74 TKernelType& kernel,
75 const bool singleMode,
76 const bool naive,
77 const double base);
78
80 bool Naive() const;
82 bool& Naive();
83
85 bool SingleMode() const;
87 bool& SingleMode();
88
90 int KernelType() const { return kernelType; }
92 int& KernelType() { return kernelType; }
93
106 void Search(const arma::mat& querySet,
107 const size_t k,
108 arma::Mat<size_t>& indices,
109 arma::mat& kernels,
110 const double base);
111
121 void Search(const size_t k,
122 arma::Mat<size_t>& indices,
123 arma::mat& kernels);
124
128 template<typename Archive>
129 void serialize(Archive& ar, const unsigned int /* version */);
130
131 private:
133 int kernelType;
134
149
151 template<typename FastMKSType>
152 void Search(FastMKSType& f,
153 const arma::mat& querySet,
154 const size_t k,
155 arma::Mat<size_t>& indices,
156 arma::mat& kernels,
157 const double base);
158};
159
160} // namespace fastmks
161} // namespace mlpack
162
163#include "fastmks_model_impl.hpp"
164
165#endif
A utility struct to contain all the possible FastMKS models, for use by the mlpack_fastmks program.
KernelTypes
A list of all the kernels we support.
bool Naive() const
Get whether or not naive search is used.
bool SingleMode() const
Get whether or not single-tree search is used.
FastMKSModel(const int kernelType=LINEAR_KERNEL)
Create the FastMKSModel with the given kernel type.
FastMKSModel & operator=(const FastMKSModel &other)
Copy assignment operator.
void Search(const arma::mat &querySet, const size_t k, arma::Mat< size_t > &indices, arma::mat &kernels, const double base)
Search with a different query set.
bool & Naive()
Set whether or not naive search is used.
int KernelType() const
Get the kernel type.
bool & SingleMode()
Set whether or not single-tree search is used.
int & KernelType()
Modify the kernel type.
FastMKSModel(const FastMKSModel &other)
Copy constructor.
void serialize(Archive &ar, const unsigned int)
Serialize the model.
void Search(const size_t k, arma::Mat< size_t > &indices, arma::mat &kernels)
Search with the reference set as the query set.
FastMKSModel(FastMKSModel &&other)
Move constructor.
void BuildModel(arma::mat &&referenceData, TKernelType &kernel, const bool singleMode, const bool naive, const double base)
Build the model on the given reference set.
An implementation of fast exact max-kernel search.
Definition: fastmks.hpp:64
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.