mlpack  2.0.1
fastmks_model.hpp
Go to the documentation of this file.
1 
14 #ifndef __MLPACK_METHODS_FASTMKS_FASTMKS_MODEL_HPP
15 #define __MLPACK_METHODS_FASTMKS_FASTMKS_MODEL_HPP
16 
17 #include <mlpack/core.hpp>
18 #include "fastmks.hpp"
19 
20 namespace mlpack {
21 namespace fastmks {
22 
26 {
27  public:
30  {
38  };
39 
44 
48  ~FastMKSModel();
49 
54  template<typename TKernelType>
55  void BuildModel(const arma::mat& referenceData,
56  TKernelType& kernel,
57  const bool singleMode,
58  const bool naive,
59  const double base);
60 
62  bool Naive() const;
64  bool& Naive();
65 
67  bool SingleMode() const;
69  bool& SingleMode();
70 
72  int KernelType() const { return kernelType; }
74  int& KernelType() { return kernelType; }
75 
88  void Search(const arma::mat& querySet,
89  const size_t k,
90  arma::Mat<size_t>& indices,
91  arma::mat& kernels,
92  const double base);
93 
103  void Search(const size_t k,
104  arma::Mat<size_t>& indices,
105  arma::mat& kernels);
106 
110  template<typename Archive>
111  void Serialize(Archive& ar, const unsigned int /* version */);
112 
113  private:
116 
131 
133  template<typename FastMKSType>
134  void Search(FastMKSType& f,
135  const arma::mat& querySet,
136  const size_t k,
137  arma::Mat<size_t>& indices,
138  arma::mat& kernels,
139  const double base);
140 };
141 
142 } // namespace fastmks
143 } // namespace mlpack
144 
145 #include "fastmks_model_impl.hpp"
146 
147 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
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.
FastMKS< kernel::HyperbolicTangentKernel > * hyptan
This will only be non-NULL if this is the type of kernel we are using.
int KernelType() const
Get the kernel type.
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.
bool SingleMode() const
Get whether or not single-tree search is used.
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...
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
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.
bool Naive() const
Get whether or not naive search is used.
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.
An implementation of fast exact max-kernel search.
Definition: fastmks.hpp:64
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.