|
| RASearchRules (const arma::mat &referenceSet, const arma::mat &querySet, arma::Mat< size_t > &neighbors, arma::mat &distances, MetricType &metric, const double tau=5, const double alpha=0.95, const bool naive=false, const bool sampleAtLeaves=false, const bool firstLeafExact=false, const size_t singleSampleLimit=20) |
|
double | BaseCase (const size_t queryIndex, const size_t referenceIndex) |
|
size_t | NumDistComputations () |
|
size_t | NumEffectiveSamples () |
|
double | Rescore (const size_t queryIndex, TreeType &referenceNode, const double oldScore) |
| Re-evaluate the score for recursion order. More...
|
|
double | Rescore (TreeType &queryNode, TreeType &referenceNode, const double oldScore) |
| Re-evaluate the score for recursion order. More...
|
|
double | Score (const size_t queryIndex, TreeType &referenceNode) |
| Get the score for recursion order. More...
|
|
double | Score (const size_t queryIndex, TreeType &referenceNode, const double baseCaseResult) |
| Get the score for recursion order. More...
|
|
double | Score (TreeType &queryNode, TreeType &referenceNode) |
| Get the score for recursion order. More...
|
|
double | Score (TreeType &queryNode, TreeType &referenceNode, const double baseCaseResult) |
| Get the score for recursion order, passing the base case result (in the situation where it may be needed to calculate the recursion order). More...
|
|
const TraversalInfoType & | TraversalInfo () const |
|
TraversalInfoType & | TraversalInfo () |
|
|
void | InsertNeighbor (const size_t queryIndex, const size_t pos, const size_t neighbor, const double distance) |
| Insert a point into the neighbors and distances matrices; this is a helper function. More...
|
|
size_t | MinimumSamplesReqd (const size_t n, const size_t k, const double tau, const double alpha) const |
| Compute the minimum number of samples required to guarantee the given rank-approximation and success probability. More...
|
|
void | ObtainDistinctSamples (const size_t numSamples, const size_t rangeUpperBound, arma::uvec &distinctSamples) const |
| Pick up desired number of samples (with replacement) from a given range of integers so that only the distinct samples are returned from the range [0 - specified upper bound) More...
|
|
double | Score (const size_t queryIndex, TreeType &referenceNode, const double distance, const double bestDistance) |
| Perform actual scoring for single-tree case. More...
|
|
double | Score (TreeType &queryNode, TreeType &referenceNode, const double distance, const double bestDistance) |
| Perform actual scoring for dual-tree case. More...
|
|
double | SuccessProbability (const size_t n, const size_t k, const size_t m, const size_t t) const |
| Compute the success probability of obtaining 'k'-neighbors from a set of size 'n' within the top 't' neighbors if 'm' samples are made. More...
|
|
template<typename SortPolicy, typename MetricType, typename TreeType>
class mlpack::neighbor::RASearchRules< SortPolicy, MetricType, TreeType >
Definition at line 34 of file ra_search_rules.hpp.
template<typename SortPolicy , typename MetricType , typename TreeType >
double mlpack::neighbor::RASearchRules< SortPolicy, MetricType, TreeType >::Rescore |
( |
const size_t |
queryIndex, |
|
|
TreeType & |
referenceNode, |
|
|
const double |
oldScore |
|
) |
| |
Re-evaluate the score for recursion order.
A low score indicates priority for recursion, while DBL_MAX indicates that the node should not be recursed into at all (it should be pruned). This is used when the score has already been calculated, but another recursion may have modified the bounds for pruning. So the old score is checked against the new pruning bound.
For rank-approximation, it also checks if the number of samples left for a query to satisfy the rank constraint is small enough at this point of the algorithm, then this node is approximated by sampling and given a new score of 'DBL_MAX'.
- Parameters
-
queryIndex | Index of query point. |
referenceNode | Candidate node to be recursed into. |
oldScore | Old score produced by Score() (or Rescore()). |
template<typename SortPolicy , typename MetricType , typename TreeType >
double mlpack::neighbor::RASearchRules< SortPolicy, MetricType, TreeType >::Rescore |
( |
TreeType & |
queryNode, |
|
|
TreeType & |
referenceNode, |
|
|
const double |
oldScore |
|
) |
| |
Re-evaluate the score for recursion order.
A low score indicates priority for recursion, while DBL_MAX indicates that the node should not be recursed into at all (it should be pruned). This is used when the score has already been calculated, but another recursion may have modified the bounds for pruning. So the old score is checked against the new pruning bound.
For the rank-approximation, we check if the referenceNode can be approximated by sampling. If it can be, enough samples are made for every query in the queryNode. No further query-tree traversal is performed.
The 'NumSamplesMade' query stat is propagated up the tree. And then if pruning occurs (by distance or by sampling), the 'NumSamplesMade' stat is not propagated down the tree. If no pruning occurs, the stat is propagated down the tree.
- Parameters
-
queryNode | Candidate query node to recurse into. |
referenceNode | Candidate reference node to recurse into. |
oldScore | Old score produced by Socre() (or Rescore()). |
template<typename SortPolicy , typename MetricType , typename TreeType >
Get the score for recursion order.
A low score indicates priority for recursion, while DBL_MAX indicates that the node should not be recursed into at all (it should be pruned).
For rank-approximation, the scoring function first checks if pruning by distance is possible. If yes, then the node is given the score of 'DBL_MAX' and the expected number of samples from that node are added to the number of samples made for the query.
If no, then the function tries to see if the node can be pruned by approximation. If number of samples required from this node is small enough, then that number of samples are acquired from this node and the score is set to be 'DBL_MAX'.
If the pruning by approximation is not possible either, the algorithm continues with the usual tree-traversal.
- Parameters
-
queryIndex | Index of query point. |
referenceNode | Candidate node to be recursed into. |
template<typename SortPolicy , typename MetricType , typename TreeType >
double mlpack::neighbor::RASearchRules< SortPolicy, MetricType, TreeType >::Score |
( |
const size_t |
queryIndex, |
|
|
TreeType & |
referenceNode, |
|
|
const double |
baseCaseResult |
|
) |
| |
Get the score for recursion order.
A low score indicates priority for recursion, while DBL_MAX indicates that the node should not be recursed into at all (it should be pruned).
For rank-approximation, the scoring function first checks if pruning by distance is possible. If yes, then the node is given the score of 'DBL_MAX' and the expected number of samples from that node are added to the number of samples made for the query.
If no, then the function tries to see if the node can be pruned by approximation. If number of samples required from this node is small enough, then that number of samples are acquired from this node and the score is set to be 'DBL_MAX'.
If the pruning by approximation is not possible either, the algorithm continues with the usual tree-traversal.
- Parameters
-
queryIndex | Index of query point. |
referenceNode | Candidate node to be recursed into. |
baseCaseResult | Result of BaseCase(queryIndex, referenceNode). |
template<typename SortPolicy , typename MetricType , typename TreeType >
Get the score for recursion order.
A low score indicates priority for recursionm while DBL_MAX indicates that the node should not be recursed into at all (it should be pruned).
For the rank-approximation, we check if the referenceNode can be approximated by sampling. If it can be, enough samples are made for every query in the queryNode. No further query-tree traversal is performed.
The 'NumSamplesMade' query stat is propagated up the tree. And then if pruning occurs (by distance or by sampling), the 'NumSamplesMade' stat is not propagated down the tree. If no pruning occurs, the stat is propagated down the tree.
- Parameters
-
queryNode | Candidate query node to recurse into. |
referenceNode | Candidate reference node to recurse into. |
template<typename SortPolicy , typename MetricType , typename TreeType >
double mlpack::neighbor::RASearchRules< SortPolicy, MetricType, TreeType >::Score |
( |
TreeType & |
queryNode, |
|
|
TreeType & |
referenceNode, |
|
|
const double |
baseCaseResult |
|
) |
| |
Get the score for recursion order, passing the base case result (in the situation where it may be needed to calculate the recursion order).
A low score indicates priority for recursion, while DBL_MAX indicates that the node should not be recursed into at all (it should be pruned).
For the rank-approximation, we check if the referenceNode can be approximated by sampling. If it can be, enough samples are made for every query in the queryNode. No further query-tree traversal is performed.
The 'NumSamplesMade' query stat is propagated up the tree. And then if pruning occurs (by distance or by sampling), the 'NumSamplesMade' stat is not propagated down the tree. If no pruning occurs, the stat is propagated down the tree.
- Parameters
-
queryNode | Candidate query node to recurse into. |
referenceNode | Candidate reference node to recurse into. |
baseCaseResult | Result of BaseCase(queryIndex, referenceNode). |