mlpack
Public Types | Public Member Functions | List of all members
mlpack::neighbor::RAModel Class Reference

The RAModel class provides an abstraction for the RASearch class, abstracting away the TreeType parameter and allowing it to be specified at runtime in this class. More...

#include <ra_model.hpp>

Public Types

enum  TreeTypes {
  KD_TREE, COVER_TREE, R_TREE, R_STAR_TREE,
  X_TREE, HILBERT_R_TREE, R_PLUS_TREE, R_PLUS_PLUS_TREE,
  UB_TREE, OCTREE
}
 The list of tree types we can use with RASearch. More...
 

Public Member Functions

 RAModel (TreeTypes treeType=TreeTypes::KD_TREE, bool randomBasis=false)
 Initialize the RAModel with the given type and whether or not a random basis should be used.
 
 RAModel (const RAModel &other)
 Copy the given RAModel. More...
 
 RAModel (RAModel &&other)
 Take ownership of the given RAModel. More...
 
RAModeloperator= (const RAModel &other)
 Copy the given RAModel. More...
 
RAModeloperator= (RAModel &&other)
 Take ownership of the given RAModel. More...
 
 ~RAModel ()
 Clean memory, if necessary.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the model.
 
const arma::mat & Dataset () const
 Expose the dataset.
 
bool SingleMode () const
 Get whether or not single-tree search is being used.
 
bool & SingleMode ()
 Modify whether or not single-tree search is being used.
 
bool Naive () const
 Get whether or not naive search is being used.
 
bool & Naive ()
 Modify whether or not naive search is being used.
 
double Tau () const
 Get the rank-approximation in percentile of the data.
 
double & Tau ()
 Modify the rank-approximation in percentile of the data.
 
double Alpha () const
 Get the desired success probability.
 
double & Alpha ()
 Modify the desired success probability.
 
bool SampleAtLeaves () const
 Get whether or not sampling is done at the leaves.
 
bool & SampleAtLeaves ()
 Modify whether or not sampling is done at the leaves.
 
bool FirstLeafExact () const
 Get whether or not we traverse to the first leaf without approximation.
 
bool & FirstLeafExact ()
 Modify whether or not we traverse to the first leaf without approximation.
 
size_t SingleSampleLimit () const
 Get the limit on the size of a node that can be approximated.
 
size_t & SingleSampleLimit ()
 Modify the limit on the size of a node that can be approximation.
 
size_t LeafSize () const
 Get the leaf size (only relevant when the kd-tree is used).
 
size_t & LeafSize ()
 Modify the leaf size (only relevant when the kd-tree is used).
 
TreeTypes TreeType () const
 Get the type of tree being used.
 
TreeTypesTreeType ()
 Modify the type of tree being used.
 
bool RandomBasis () const
 Get whether or not a random basis is being used.
 
bool & RandomBasis ()
 Modify whether or not a random basis is being used. More...
 
void InitializeModel (const bool naive, const bool singleMode)
 Initialize the model's memory.
 
void BuildModel (arma::mat &&referenceSet, const size_t leafSize, const bool naive, const bool singleMode)
 Build the reference tree.
 
void Search (arma::mat &&querySet, const size_t k, arma::Mat< size_t > &neighbors, arma::mat &distances)
 Perform rank-approximate neighbor search, taking ownership of the query set. More...
 
void Search (const size_t k, arma::Mat< size_t > &neighbors, arma::mat &distances)
 Perform rank-approximate neighbor search, using the reference set as the query set.
 
std::string TreeName () const
 Get the name of the tree type.
 

Detailed Description

The RAModel class provides an abstraction for the RASearch class, abstracting away the TreeType parameter and allowing it to be specified at runtime in this class.

This class is written for the sake of the 'allkrann' program, but is not necessarily restricted to that use.

Member Enumeration Documentation

◆ TreeTypes

The list of tree types we can use with RASearch.

Does not include ball trees; see #338.

Constructor & Destructor Documentation

◆ RAModel() [1/2]

mlpack::neighbor::RAModel::RAModel ( const RAModel other)

Copy the given RAModel.

Parameters
otherRAModel to copy.

◆ RAModel() [2/2]

mlpack::neighbor::RAModel::RAModel ( RAModel &&  other)

Take ownership of the given RAModel.

Parameters
otherRAModel to take ownership of.

Member Function Documentation

◆ operator=() [1/2]

RAModel & mlpack::neighbor::RAModel::operator= ( const RAModel other)

Copy the given RAModel.

Parameters
otherRAModel to copy.

◆ operator=() [2/2]

RAModel & mlpack::neighbor::RAModel::operator= ( RAModel &&  other)

Take ownership of the given RAModel.

Parameters
otherRAModel to take ownership of.

◆ RandomBasis()

bool& mlpack::neighbor::RAModel::RandomBasis ( )
inline

Modify whether or not a random basis is being used.

Be sure to rebuild the model using BuildModel().

◆ Search()

void mlpack::neighbor::RAModel::Search ( arma::mat &&  querySet,
const size_t  k,
arma::Mat< size_t > &  neighbors,
arma::mat &  distances 
)

Perform rank-approximate neighbor search, taking ownership of the query set.


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