mlpack
Public Types | Public Member Functions | List of all members
mlpack::fastmks::FastMKSModel Class Reference

A utility struct to contain all the possible FastMKS models, for use by the mlpack_fastmks program. More...

#include <fastmks_model.hpp>

Public Types

enum  KernelTypes {
  LINEAR_KERNEL, POLYNOMIAL_KERNEL, COSINE_DISTANCE, GAUSSIAN_KERNEL,
  EPANECHNIKOV_KERNEL, TRIANGULAR_KERNEL, HYPTAN_KERNEL
}
 A list of all the kernels we support.
 

Public Member Functions

 FastMKSModel (const int kernelType=LINEAR_KERNEL)
 Create the FastMKSModel with the given kernel type.
 
 FastMKSModel (const FastMKSModel &other)
 Copy constructor.
 
 FastMKSModel (FastMKSModel &&other)
 Move constructor.
 
FastMKSModeloperator= (const FastMKSModel &other)
 Copy assignment operator.
 
FastMKSModeloperator= (FastMKSModel &&other)
 Move assignment operator.
 
 ~FastMKSModel ()
 Clean memory.
 
template<typename TKernelType >
void BuildModel (arma::mat &&referenceData, TKernelType &kernel, const bool singleMode, const bool naive, const double base)
 Build the model on the given reference set. More...
 
bool Naive () const
 Get whether or not naive search is used.
 
bool & Naive ()
 Set whether or not naive search is used.
 
bool SingleMode () const
 Get whether or not single-tree search is used.
 
bool & SingleMode ()
 Set whether or not single-tree search is used.
 
int KernelType () const
 Get the kernel type.
 
int & KernelType ()
 Modify the kernel type.
 
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. More...
 
void Search (const size_t k, arma::Mat< size_t > &indices, arma::mat &kernels)
 Search with the reference set as the query set. More...
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the model.
 

Detailed Description

A utility struct to contain all the possible FastMKS models, for use by the mlpack_fastmks program.

Member Function Documentation

◆ BuildModel()

template<typename TKernelType >
void mlpack::fastmks::FastMKSModel::BuildModel ( arma::mat &&  referenceData,
TKernelType &  kernel,
const bool  singleMode,
const bool  naive,
const double  base 
)

Build the model on the given reference set.

Make sure kernelType is equal to the correct entry in KernelTypes for the given KernelType class!

◆ Search() [1/2]

void FastMKSModel::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.

Parameters
querySetSet to search with.
kNumber of max-kernel candidates to search for.
indicesA matrix in which to store the indices of max-kernel candidates.
kernelsA matrix in which to store the max-kernel candidate kernel values.
baseBase to use for cover tree building (if in dual-tree search mode).

◆ Search() [2/2]

void FastMKSModel::Search ( const size_t  k,
arma::Mat< size_t > &  indices,
arma::mat &  kernels 
)

Search with the reference set as the query set.

Parameters
kNumber of max-kernel candidates to search for.
indicesA matrix in which to store the indices of max-kernel candidates.
kernelsA matrix in which to store the max-kernel candidate kernel values.

The documentation for this class was generated from the following files: