mlpack
|
The FastMKSRules class is a template helper class used by FastMKS class when performing exact max-kernel search. More...
#include <fastmks_rules.hpp>
Public Types | |
typedef tree::TraversalInfo< TreeType > | TraversalInfoType |
Public Member Functions | |
FastMKSRules (const typename TreeType::Mat &referenceSet, const typename TreeType::Mat &querySet, const size_t k, KernelType &kernel) | |
Construct the FastMKSRules object. More... | |
void | GetResults (arma::Mat< size_t > &indices, arma::mat &products) |
Store the list of candidates for each query point in the given matrices. More... | |
double | BaseCase (const size_t queryIndex, const size_t referenceIndex) |
Compute the base case (kernel value) between two points. | |
double | Score (const size_t queryIndex, TreeType &referenceNode) |
Get the score for recursion order. More... | |
double | Score (TreeType &queryNode, TreeType &referenceNode) |
Get the score for recursion order. More... | |
double | Rescore (const size_t queryIndex, TreeType &referenceNode, const double oldScore) const |
Re-evaluate the score for recursion order. More... | |
double | Rescore (TreeType &queryNode, TreeType &referenceNode, const double oldScore) const |
Re-evaluate the score for recursion order. More... | |
size_t | BaseCases () const |
Get the number of times BaseCase() was called. | |
size_t & | BaseCases () |
Modify the number of times BaseCase() was called. | |
size_t | Scores () const |
Get the number of times Score() was called. | |
size_t & | Scores () |
Modify the number of times Score() was called. | |
const TraversalInfoType & | TraversalInfo () const |
TraversalInfoType & | TraversalInfo () |
size_t | MinimumBaseCases () const |
Get the minimum number of base cases we need to perform to have acceptable results. More... | |
The FastMKSRules class is a template helper class used by FastMKS class when performing exact max-kernel search.
For each point in the query dataset, it keeps track of the k best candidates in the reference dataset.
mlpack::fastmks::FastMKSRules< KernelType, TreeType >::FastMKSRules | ( | const typename TreeType::Mat & | referenceSet, |
const typename TreeType::Mat & | querySet, | ||
const size_t | k, | ||
KernelType & | kernel | ||
) |
Construct the FastMKSRules object.
This is usually done from within the FastMKS class at search time.
referenceSet | Set of reference data. |
querySet | Set of query data. |
k | Number of candidates to search for. |
kernel | Kernel to run FastMKS with. |
void mlpack::fastmks::FastMKSRules< KernelType, TreeType >::GetResults | ( | arma::Mat< size_t > & | indices, |
arma::mat & | products | ||
) |
Store the list of candidates for each query point in the given matrices.
indices | Matrix storing lists of candidate for each query point. |
products | Matrix storing kernel value for each candidate. |
|
inline |
Get the minimum number of base cases we need to perform to have acceptable results.
double mlpack::fastmks::FastMKSRules< KernelType, 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 a 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.
double mlpack::fastmks::FastMKSRules< KernelType, 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 a 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.
double mlpack::fastmks::FastMKSRules< KernelType, TreeType >::Score | ( | const size_t | queryIndex, |
TreeType & | referenceNode | ||
) |
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).
queryIndex | Index of query point. |
referenceNode | Candidate to be recursed into. |
double mlpack::fastmks::FastMKSRules< KernelType, TreeType >::Score | ( | TreeType & | queryNode, |
TreeType & | referenceNode | ||
) |
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).
queryNode | Candidate query node to be recursed into. |
referenceNode | Candidate reference node to be recursed into. |