mlpack  master
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 
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(const 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:
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
bool Naive() const
Get whether or not naive search is used.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
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.
The core includes that mlpack expects; standard C++ includes and Armadillo.
FastMKS< kernel::HyperbolicTangentKernel > * hyptan
This will only be non-NULL if this is the type of kernel we are using.
bool SingleMode() const
Get whether or not single-tree search is used.
FastMKS< kernel::TriangularKernel > * triangular
This will only be non-NULL if this is the type of kernel we are using.
FastMKS< kernel::GaussianKernel > * gaussian
This will only be non-NULL if this is the type of kernel we are using.
FastMKS< kernel::PolynomialKernel > * polynomial
This will only be non-NULL if this is the type of kernel we are using.
int & KernelType()
Modify the kernel type.
FastMKS< kernel::EpanechnikovKernel > * epan
This will only be non-NULL if this is the type of kernel we are using.
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.
FastMKS< kernel::CosineDistance > * cosine
This will only be non-NULL if this is the type of kernel we are using.
int KernelType() const
Get the kernel type.
KernelTypes
A list of all the kernels we support.
void Serialize(Archive &ar, const unsigned int)
Serialize the model.
int kernelType
The type of kernel we are using.
FastMKS< kernel::LinearKernel > * linear
This will only be non-NULL if this is the type of kernel we are using.
FastMKSModel(const int kernelType=LINEAR_KERNEL)
Create the FastMKSModel with the given kernel type.