MLPACK  1.0.4
Public Member Functions | Private Member Functions | Private Attributes
mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType > Class Template Reference

List of all members.

Public Member Functions

 NeighborSearchRules (const arma::mat &referenceSet, const arma::mat &querySet, arma::Mat< size_t > &neighbors, arma::mat &distances, MetricType &metric)
double BaseCase (const size_t queryIndex, const size_t referenceIndex)
double Prescore (TreeType &queryNode, TreeType &referenceNode, TreeType &referenceChildNode, const double baseCaseResult) const
 Get the score for the recursion order, in general before the base case is computed.
double Rescore (const size_t queryIndex, TreeType &referenceNode, const double oldScore) const
 Re-evaluate the score for recursion order.
double Rescore (TreeType &queryNode, TreeType &referenceNode, const double oldScore) const
 Re-evaluate the score for recursion order.
double Score (const size_t queryIndex, TreeType &referenceNode) const
 Get the score for recursion order.
double Score (const size_t queryIndex, TreeType &referenceNode, const double baseCaseResult) const
 Get the score for recursion order, passing the base case result (in the situation where it may be needed to calculate the recursion order).
double Score (TreeType &queryNode, TreeType &referenceNode) const
 Get the score for recursion order.
double Score (TreeType &queryNode, TreeType &referenceNode, const double baseCaseResult) const
 Get the score for recursion order, passing the base case result (in the situation where it may be needed to calculate the recursion order).

Private Member Functions

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.

Private Attributes

arma::mat & distances
 The matrix the resultant neighbor distances should be stored in.
MetricType & metric
 The instantiated metric.
arma::Mat< size_t > & neighbors
 The matrix the resultant neighbor indices should be stored in.
const arma::mat & querySet
 The query set.
const arma::mat & referenceSet
 The reference set.

Detailed Description

template<typename SortPolicy, typename MetricType, typename TreeType>
class mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >

Definition at line 30 of file neighbor_search_rules.hpp.


Constructor & Destructor Documentation

template<typename SortPolicy , typename MetricType , typename TreeType >
mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::NeighborSearchRules ( const arma::mat &  referenceSet,
const arma::mat &  querySet,
arma::Mat< size_t > &  neighbors,
arma::mat &  distances,
MetricType &  metric 
)

Member Function Documentation

template<typename SortPolicy , typename MetricType , typename TreeType >
double mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::BaseCase ( const size_t  queryIndex,
const size_t  referenceIndex 
)
template<typename SortPolicy , typename MetricType , typename TreeType >
void mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::InsertNeighbor ( const size_t  queryIndex,
const size_t  pos,
const size_t  neighbor,
const double  distance 
) [private]

Insert a point into the neighbors and distances matrices; this is a helper function.

Parameters:
queryIndexIndex of point whose neighbors we are inserting into.
posPosition in list to insert into.
neighborIndex of reference point which is being inserted.
distanceDistance from query point to reference point.
template<typename SortPolicy , typename MetricType , typename TreeType >
double mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::Prescore ( TreeType &  queryNode,
TreeType &  referenceNode,
TreeType &  referenceChildNode,
const double  baseCaseResult 
) const

Get the score for the recursion order, in general before the base case is computed.

This is useful for cover trees or other trees that can cache some statistic that could be used to make a prune of a child before its base case is computed.

Parameters:
queryNodeQuery node.
referenceNodeReference node.
template<typename SortPolicy , typename MetricType , typename TreeType >
double mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::Rescore ( const size_t  queryIndex,
TreeType &  referenceNode,
const double  oldScore 
) const

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.

Parameters:
queryIndexIndex of query point.
referenceNodeCandidate node to be recursed into.
oldScoreOld score produced by Score() (or Rescore()).
template<typename SortPolicy , typename MetricType , typename TreeType >
double mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::Rescore ( TreeType &  queryNode,
TreeType &  referenceNode,
const double  oldScore 
) const

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.

Parameters:
queryNodeCandidate query node to recurse into.
referenceNodeCandidate reference node to recurse into.
oldScoreOld score produced by Socre() (or Rescore()).
template<typename SortPolicy , typename MetricType , typename TreeType >
double mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::Score ( const size_t  queryIndex,
TreeType &  referenceNode 
) const

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).

Parameters:
queryIndexIndex of query point.
referenceNodeCandidate node to be recursed into.
template<typename SortPolicy , typename MetricType , typename TreeType >
double mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::Score ( const size_t  queryIndex,
TreeType &  referenceNode,
const double  baseCaseResult 
) const

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).

Parameters:
queryIndexIndex of query point.
referenceNodeCandidate node to be recursed into.
baseCaseResultResult of BaseCase(queryIndex, referenceNode).
template<typename SortPolicy , typename MetricType , typename TreeType >
double mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::Score ( TreeType &  queryNode,
TreeType &  referenceNode 
) const

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).

Parameters:
queryNodeCandidate query node to recurse into.
referenceNodeCandidate reference node to recurse into.
template<typename SortPolicy , typename MetricType , typename TreeType >
double mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::Score ( TreeType &  queryNode,
TreeType &  referenceNode,
const double  baseCaseResult 
) const

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).

Parameters:
queryNodeCandidate query node to recurse into.
referenceNodeCandidate reference node to recurse into.
baseCaseResultResult of BaseCase(queryIndex, referenceNode).

Member Data Documentation

template<typename SortPolicy , typename MetricType , typename TreeType >
arma::mat& mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::distances [private]

The matrix the resultant neighbor distances should be stored in.

Definition at line 144 of file neighbor_search_rules.hpp.

template<typename SortPolicy , typename MetricType , typename TreeType >
MetricType& mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::metric [private]

The instantiated metric.

Definition at line 147 of file neighbor_search_rules.hpp.

template<typename SortPolicy , typename MetricType , typename TreeType >
arma::Mat<size_t>& mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::neighbors [private]

The matrix the resultant neighbor indices should be stored in.

Definition at line 141 of file neighbor_search_rules.hpp.

template<typename SortPolicy , typename MetricType , typename TreeType >
const arma::mat& mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::querySet [private]

The query set.

Definition at line 138 of file neighbor_search_rules.hpp.

template<typename SortPolicy , typename MetricType , typename TreeType >
const arma::mat& mlpack::neighbor::NeighborSearchRules< SortPolicy, MetricType, TreeType >::referenceSet [private]

The reference set.

Definition at line 135 of file neighbor_search_rules.hpp.


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