|
mlpack
|
The NSModel class provides an easy way to serialize a model, abstracts away the different types of trees, and also reflects the NeighborSearch API. More...
#include <ns_model.hpp>
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, SPILL_TREE, UB_TREE, OCTREE } |
| Enum type to identify each accepted tree type. | |
Public Member Functions | |
| NSModel (TreeTypes treeType=TreeTypes::KD_TREE, bool randomBasis=false) | |
| Initialize the NSModel with the given type and whether or not a random basis should be used. More... | |
| NSModel (const NSModel &other) | |
| Copy the given NSModel. More... | |
| NSModel (NSModel &&other) | |
| Take ownership of the given NSModel. More... | |
| NSModel & | operator= (const NSModel &other) |
| Copy the given NSModel. More... | |
| NSModel & | operator= (NSModel &&other) |
| Take ownership of the given NSModel. More... | |
| ~NSModel () | |
| Clean memory, if necessary. | |
| template<typename Archive > | |
| void | serialize (Archive &ar, const uint32_t) |
| Serialize the neighbor search model. More... | |
| const arma::mat & | Dataset () const |
| Expose the dataset. | |
| NeighborSearchMode | SearchMode () const |
| Expose SearchMode. More... | |
| NeighborSearchMode & | SearchMode () |
| Modify the search mode. | |
| size_t | LeafSize () const |
| Expose LeafSize. | |
| size_t & | LeafSize () |
| double | Tau () const |
| Expose Tau. | |
| double & | Tau () |
| double | Rho () const |
| Expose Rho. | |
| double & | Rho () |
| double | Epsilon () const |
| Expose Epsilon. | |
| double & | Epsilon () |
| TreeTypes | TreeType () const |
| Expose treeType. | |
| TreeTypes & | TreeType () |
| bool | RandomBasis () const |
| Expose randomBasis. | |
| bool & | RandomBasis () |
| void | InitializeModel (const NeighborSearchMode searchMode, const double epsilon) |
| Initialize the model type. (This does not perform any training.) More... | |
| void | BuildModel (arma::mat &&referenceSet, const NeighborSearchMode searchMode, const double epsilon=0) |
| Build the reference tree. | |
| void | Search (arma::mat &&querySet, const size_t k, arma::Mat< size_t > &neighbors, arma::mat &distances) |
| Perform neighbor search. The query set will be reordered. | |
| void | Search (const size_t k, arma::Mat< size_t > &neighbors, arma::mat &distances) |
| Perform monochromatic neighbor search. More... | |
| std::string | TreeName () const |
| Return a string representation of the current tree type. More... | |
The NSModel class provides an easy way to serialize a model, abstracts away the different types of trees, and also reflects the NeighborSearch API.
This class is meant to be used by the command-line mlpack_knn and mlpack_kfn programs, and thus does not have the same complete functionality and flexibility as the NeighborSearch class. So if you are using it outside of mlpack_knn and mlpack_kfn, be aware that it is limited!
| SortPolicy | The sort policy for distances; see NearestNeighborSort. |
| mlpack::neighbor::NSModel< SortPolicy >::NSModel | ( | TreeTypes | treeType = TreeTypes::KD_TREE, |
| bool | randomBasis = false |
||
| ) |
Initialize the NSModel with the given type and whether or not a random basis should be used.
| treeType | Type of tree to use. |
| randomBasis | Whether or not to project the points onto a random basis before searching. |
| mlpack::neighbor::NSModel< SortPolicy >::NSModel | ( | const NSModel< SortPolicy > & | other | ) |
Copy the given NSModel.
| other | Model to copy. |
| mlpack::neighbor::NSModel< SortPolicy >::NSModel | ( | NSModel< SortPolicy > && | other | ) |
Take ownership of the given NSModel.
| other | Model to take ownership of. |
| void mlpack::neighbor::NSModel< SortPolicy >::InitializeModel | ( | const NeighborSearchMode | searchMode, |
| const double | epsilon | ||
| ) |
Initialize the model type. (This does not perform any training.)
Initialize a model given the tree type. (No training happens here.)
| NSModel< SortPolicy > & mlpack::neighbor::NSModel< SortPolicy >::operator= | ( | const NSModel< SortPolicy > & | other | ) |
Copy the given NSModel.
| other | Model to copy. |
| NSModel< SortPolicy > & mlpack::neighbor::NSModel< SortPolicy >::operator= | ( | NSModel< SortPolicy > && | other | ) |
Take ownership of the given NSModel.
| other | Model to take ownership of. |
| void mlpack::neighbor::NSModel< SortPolicy >::Search | ( | const size_t | k, |
| arma::Mat< size_t > & | neighbors, | ||
| arma::mat & | distances | ||
| ) |
Perform monochromatic neighbor search.
Perform neighbor search.
| NeighborSearchMode mlpack::neighbor::NSModel< SortPolicy >::SearchMode | ( | ) | const |
Expose SearchMode.
Access the search mode.
| void mlpack::neighbor::NSModel< SortPolicy >::serialize | ( | Archive & | ar, |
| const uint32_t | |||
| ) |
Serialize the neighbor search model.
Serialize the kNN model.
| std::string mlpack::neighbor::NSModel< SortPolicy >::TreeName | ( | ) | const |
Return a string representation of the current tree type.
Get the name of the tree type.
1.8.13