mlpack  2.2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
57  ~FastMKSModel();
58 
63  template<typename TKernelType>
64  void BuildModel(const arma::mat& referenceData,
65  TKernelType& kernel,
66  const bool singleMode,
67  const bool naive,
68  const double base);
69 
71  bool Naive() const;
73  bool& Naive();
74 
76  bool SingleMode() const;
78  bool& SingleMode();
79 
81  int KernelType() const { return kernelType; }
83  int& KernelType() { return kernelType; }
84 
97  void Search(const arma::mat& querySet,
98  const size_t k,
99  arma::Mat<size_t>& indices,
100  arma::mat& kernels,
101  const double base);
102 
112  void Search(const size_t k,
113  arma::Mat<size_t>& indices,
114  arma::mat& kernels);
115 
119  template<typename Archive>
120  void Serialize(Archive& ar, const unsigned int /* version */);
121 
122  private:
124  int kernelType;
125 
140 
142  template<typename FastMKSType>
143  void Search(FastMKSType& f,
144  const arma::mat& querySet,
145  const size_t k,
146  arma::Mat<size_t>& indices,
147  arma::mat& kernels,
148  const double base);
149 };
150 
151 } // namespace fastmks
152 } // namespace mlpack
153 
154 #include "fastmks_model_impl.hpp"
155 
156 #endif
int KernelType() const
Get the kernel type.
The core includes that mlpack expects; standard C++ includes and Armadillo.
bool SingleMode() const
Get whether or not single-tree search is used.
void Serialize(Archive &ar, const unsigned int)
Serialize the model.
bool Naive() const
Get whether or not naive search is used.
A utility struct to contain all the possible FastMKS models, for use by the mlpack_fastmks program...
void BuildModel(const arma::mat &referenceData, TKernelType &kernel, const bool singleMode, const bool naive, const double base)
Build the model on the given reference set.
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.
int & KernelType()
Modify the kernel type.