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 
29 namespace mlpack {
30 namespace fastmks {
31 
35 {
36  public:
39  {
47  };
48 
52  FastMKSModel(const int kernelType = LINEAR_KERNEL);
53 
55  FastMKSModel(const FastMKSModel& other);
56 
58  FastMKSModel(FastMKSModel&& other);
59 
61  FastMKSModel& operator=(const FastMKSModel& other);
62 
65 
69  ~FastMKSModel();
70 
75  template<typename TKernelType>
76  void BuildModel(util::Timers& timers,
77  arma::mat&& referenceData,
78  TKernelType& kernel,
79  const bool singleMode,
80  const bool naive,
81  const double base);
82 
84  bool Naive() const;
86  bool& Naive();
87 
89  bool SingleMode() const;
91  bool& SingleMode();
92 
94  int KernelType() const { return kernelType; }
96  int& KernelType() { return kernelType; }
97 
110  void Search(util::Timers& timers,
111  const arma::mat& querySet,
112  const size_t k,
113  arma::Mat<size_t>& indices,
114  arma::mat& kernels,
115  const double base);
116 
126  void Search(util::Timers& timers,
127  const size_t k,
128  arma::Mat<size_t>& indices,
129  arma::mat& kernels);
130 
134  template<typename Archive>
135  void serialize(Archive& ar, const uint32_t /* version */);
136 
137  private:
139  int kernelType;
140 
155 
157  template<typename FastMKSType>
158  void Search(util::Timers& timers,
159  FastMKSType& f,
160  const arma::mat& querySet,
161  const size_t k,
162  arma::Mat<size_t>& indices,
163  arma::mat& kernels,
164  const double base);
165 };
166 
167 } // namespace fastmks
168 } // namespace mlpack
169 
170 #include "fastmks_model_impl.hpp"
171 
172 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
bool Naive() const
Get whether or not naive search is used.
int KernelType() const
Get the kernel type.
void serialize(Archive &ar, const uint32_t)
Serialize the model.
void BuildModel(util::Timers &timers, arma::mat &&referenceData, TKernelType &kernel, const bool singleMode, const bool naive, const double base)
Build the model on the given reference set.
A utility struct to contain all the possible FastMKS models, for use by the mlpack_fastmks program...
void Search(util::Timers &timers, 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 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.
KernelTypes
A list of all the kernels we support.
An implementation of fast exact max-kernel search.
Definition: fastmks.hpp:63
FastMKSModel & operator=(const FastMKSModel &other)
Copy assignment operator.
int & KernelType()
Modify the kernel type.