Public Types

enum  TreeTypes
{
  KD_TREE
,
  COVER_TREE
,
  R_TREE
,
  R_STAR_TREE
,
  BALL_TREE
,
  X_TREE
,
  HILBERT_R_TREE
,
  R_PLUS_TREE
,
  R_PLUS_PLUS_TREE
,
  VP_TREE
,
  RP_TREE
,
  MAX_RP_TREE
,
  UB_TREE
,
  OCTREE

}
 

Public Member Functions

 RSModel (const TreeTypes treeType=TreeTypes::KD_TREE, const bool randomBasis=false)
 Initialize the RSModel with the given type and whether or not a random basis should be used. More...

 
 RSModel (const RSModel &other)
 Copy the given RSModel. More...

 
 RSModel (RSModel &&other)
 Take ownership of the given RSModel. More...

 
 ~RSModel ()
 Clean memory, if necessary. More...

 
void BuildModel (arma::mat &&referenceSet, const size_t leafSize, const bool naive, const bool singleMode)
 Build the reference tree on the given dataset with the given parameters. More...

 
const arma::mat & Dataset () const
 Expose the dataset. More...

 
size_t LeafSize () const
 Get the leaf size (applicable to everything but the cover tree). More...

 
size_t & LeafSize ()
 Modify the leaf size (applicable to everything but the cover tree). More...

 
bool Naive () const
 Get whether the model is in naive search mode. More...

 
bool & Naive ()
 Modify whether the model is in naive search mode. More...

 
RSModeloperator= (RSModel other)
 Copy the given RSModel. More...

 
bool RandomBasis () const
 Get whether a random basis is used. More...

 
bool & RandomBasis ()
 Modify whether a random basis is used (don't do this after the model has been built). More...

 
void Search (arma::mat &&querySet, const math::Range &range, std::vector< std::vector< size_t >> &neighbors, std::vector< std::vector< double >> &distances)
 Perform range search. More...

 
void Search (const math::Range &range, std::vector< std::vector< size_t >> &neighbors, std::vector< std::vector< double >> &distances)
 Perform monochromatic range search, with the reference set as the query set. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const unsigned int)
 Serialize the range search model. More...

 
bool SingleMode () const
 Get whether the model is in single-tree search mode. More...

 
bool & SingleMode ()
 Modify whether the model is in single-tree search mode. More...

 
TreeTypes TreeType () const
 Get the type of tree. More...

 
TreeTypesTreeType ()
 Modify the type of tree (don't do this after the model has been built). More...

 

Detailed Description

Definition at line 212 of file rs_model.hpp.

Member Enumeration Documentation

◆ TreeTypes

enum TreeTypes
Enumerator
KD_TREE 
COVER_TREE 
R_TREE 
R_STAR_TREE 
BALL_TREE 
X_TREE 
HILBERT_R_TREE 
R_PLUS_TREE 
R_PLUS_PLUS_TREE 
VP_TREE 
RP_TREE 
MAX_RP_TREE 
UB_TREE 
OCTREE 

Definition at line 215 of file rs_model.hpp.

Constructor & Destructor Documentation

◆ RSModel() [1/3]

RSModel ( const TreeTypes  treeType = TreeTypes::KD_TREE,
const bool  randomBasis = false 
)

Initialize the RSModel with the given type and whether or not a random basis should be used.

Parameters
treeTypeType of tree to use.
randomBasisWhether or not to use a random basis.

◆ RSModel() [2/3]

RSModel ( const RSModel other)

Copy the given RSModel.

Parameters
otherRSModel to copy.

◆ RSModel() [3/3]

RSModel ( RSModel &&  other)

Take ownership of the given RSModel.

Parameters
otherRSModel to take ownership of.

◆ ~RSModel()

~RSModel ( )

Clean memory, if necessary.

Member Function Documentation

◆ BuildModel()

void BuildModel ( arma::mat &&  referenceSet,
const size_t  leafSize,
const bool  naive,
const bool  singleMode 
)

Build the reference tree on the given dataset with the given parameters.

This takes possession of the reference set to avoid a copy.

Parameters
referenceSetSet of reference points.
leafSizeLeaf size of tree (ignored for the cover tree).
naiveWhether naive search should be used.
singleModeWhether single-tree search should be used.

◆ Dataset()

const arma::mat& Dataset ( ) const

Expose the dataset.

◆ LeafSize() [1/2]

size_t LeafSize ( ) const
inline

Get the leaf size (applicable to everything but the cover tree).

Definition at line 319 of file rs_model.hpp.

◆ LeafSize() [2/2]

size_t& LeafSize ( )
inline

Modify the leaf size (applicable to everything but the cover tree).

Definition at line 321 of file rs_model.hpp.

◆ Naive() [1/2]

bool Naive ( ) const

Get whether the model is in naive search mode.

◆ Naive() [2/2]

bool& Naive ( )

Modify whether the model is in naive search mode.

◆ operator=()

RSModel& operator= ( RSModel  other)

Copy the given RSModel.

Use std::move to pass in the model if the old copy is no longer needed.

Parameters
otherRSModel to copy.

◆ RandomBasis() [1/2]

bool RandomBasis ( ) const
inline

Get whether a random basis is used.

Definition at line 329 of file rs_model.hpp.

◆ RandomBasis() [2/2]

bool& RandomBasis ( )
inline

Modify whether a random basis is used (don't do this after the model has been built).

Definition at line 332 of file rs_model.hpp.

References mlpack::bindings::tests::CleanMemory().

◆ Search() [1/2]

void Search ( arma::mat &&  querySet,
const math::Range range,
std::vector< std::vector< size_t >> &  neighbors,
std::vector< std::vector< double >> &  distances 
)

Perform range search.

This takes possession of the query set, so the query set will not be usable after the search. For more information on the output format, see RangeSearch<>::Search().

Parameters
querySetSet of query points.
rangeRange to search for.
neighborsOutput: neighbors falling within the desired range.
distancesOutput: distances of neighbors.

◆ Search() [2/2]

void Search ( const math::Range range,
std::vector< std::vector< size_t >> &  neighbors,
std::vector< std::vector< double >> &  distances 
)

Perform monochromatic range search, with the reference set as the query set.

For more information on the output format, see RangeSearch<>::Search().

Parameters
rangeRange to search for.
neighborsOutput: neighbors falling within the desired range.
distancesOutput: distances of neighbors.

◆ serialize()

void serialize ( Archive &  ar,
const unsigned  int 
)

Serialize the range search model.

◆ SingleMode() [1/2]

bool SingleMode ( ) const

Get whether the model is in single-tree search mode.

◆ SingleMode() [2/2]

bool& SingleMode ( )

Modify whether the model is in single-tree search mode.

◆ TreeType() [1/2]

TreeTypes TreeType ( ) const
inline

Get the type of tree.

Definition at line 324 of file rs_model.hpp.

◆ TreeType() [2/2]

TreeTypes& TreeType ( )
inline

Modify the type of tree (don't do this after the model has been built).

Definition at line 326 of file rs_model.hpp.


The documentation for this class was generated from the following file:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-3.2.1/src/mlpack/methods/range_search/rs_model.hpp