The FastMKSRules class is a template helper class used by FastMKS class when performing exact max-kernel search. More...
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... | |
double | BaseCase (const size_t queryIndex, const size_t referenceIndex) |
Compute the base case (kernel value) between two points. More... | |
size_t | BaseCases () const |
Get the number of times BaseCase() was called. More... | |
size_t & | BaseCases () |
Modify the number of times BaseCase() was called. 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... | |
size_t | MinimumBaseCases () const |
Get the minimum number of base cases we need to perform to have acceptable results. 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... | |
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... | |
size_t | Scores () const |
Get the number of times Score() was called. More... | |
size_t & | Scores () |
Modify the number of times Score() was called. More... | |
const TraversalInfoType & | TraversalInfo () const |
TraversalInfoType & | TraversalInfo () |
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.
KernelType | Type of kernel to run FastMKS with. |
TreeType | Type of tree to run FastMKS with; it must satisfy the TreeType policy API. |
Definition at line 34 of file fastmks_rules.hpp.
typedef tree::TraversalInfo<TreeType> TraversalInfoType |
Definition at line 122 of file fastmks_rules.hpp.
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. |
double BaseCase | ( | const size_t | queryIndex, |
const size_t | referenceIndex | ||
) |
Compute the base case (kernel value) between two points.
|
inline |
Get the number of times BaseCase() was called.
Definition at line 113 of file fastmks_rules.hpp.
|
inline |
Modify the number of times BaseCase() was called.
Definition at line 115 of file fastmks_rules.hpp.
void 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.
Definition at line 129 of file fastmks_rules.hpp.
double 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 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 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 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. |
|
inline |
Get the number of times Score() was called.
Definition at line 118 of file fastmks_rules.hpp.
|
inline |
Modify the number of times Score() was called.
Definition at line 120 of file fastmks_rules.hpp.
|
inline |
Definition at line 124 of file fastmks_rules.hpp.
|
inline |
Definition at line 125 of file fastmks_rules.hpp.