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 
66  ~FastMKSModel();
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 uint32_t /* 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
Linear algebra utility functions, generally performed on matrices or vectors.
void BuildModel(arma::mat &&referenceData, TKernelType &kernel, const bool singleMode, const bool naive, const double base)
Build the model on the given reference set.
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.
A utility struct to contain all the possible FastMKS models, for use by the mlpack_fastmks program...
bool SingleMode() const
Get whether or not single-tree search is used.
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.
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.