FastMKSRules< KernelType, TreeType > Class Template Reference

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

 
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 TraversalInfoTypeTraversalInfo () const
 
TraversalInfoTypeTraversalInfo ()
 

Detailed Description


template
<
typename
KernelType
,
typename
TreeType
>

class mlpack::fastmks::FastMKSRules< KernelType, TreeType >

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.

Template Parameters
KernelTypeType of kernel to run FastMKS with.
TreeTypeType of tree to run FastMKS with; it must satisfy the TreeType policy API.

Definition at line 34 of file fastmks_rules.hpp.

Member Typedef Documentation

◆ TraversalInfoType

Definition at line 122 of file fastmks_rules.hpp.

Constructor & Destructor Documentation

◆ FastMKSRules()

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.

Parameters
referenceSetSet of reference data.
querySetSet of query data.
kNumber of candidates to search for.
kernelKernel to run FastMKS with.

Member Function Documentation

◆ BaseCase()

double BaseCase ( const size_t  queryIndex,
const size_t  referenceIndex 
)

Compute the base case (kernel value) between two points.

◆ BaseCases() [1/2]

size_t BaseCases ( ) const
inline

Get the number of times BaseCase() was called.

Definition at line 113 of file fastmks_rules.hpp.

◆ BaseCases() [2/2]

size_t& BaseCases ( )
inline

Modify the number of times BaseCase() was called.

Definition at line 115 of file fastmks_rules.hpp.

◆ GetResults()

void GetResults ( arma::Mat< size_t > &  indices,
arma::mat &  products 
)

Store the list of candidates for each query point in the given matrices.

Parameters
indicesMatrix storing lists of candidate for each query point.
productsMatrix storing kernel value for each candidate.

◆ Rescore() [1/2]

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.

Parameters
queryIndexIndex of query point.
referenceNodeCandidate node to be recursed into.
oldScoreOld score produced by Score() (or Rescore()).

◆ Rescore() [2/2]

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.

Parameters
queryNodeCandidate query node to be recursed into.
referenceNodeCandidate reference node to be recursed into.
oldScoreOld score produced by Score() (or Rescore()).

◆ Score() [1/2]

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

Parameters
queryIndexIndex of query point.
referenceNodeCandidate to be recursed into.

◆ Score() [2/2]

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

Parameters
queryNodeCandidate query node to be recursed into.
referenceNodeCandidate reference node to be recursed into.

◆ Scores() [1/2]

size_t Scores ( ) const
inline

Get the number of times Score() was called.

Definition at line 118 of file fastmks_rules.hpp.

◆ Scores() [2/2]

size_t& Scores ( )
inline

Modify the number of times Score() was called.

Definition at line 120 of file fastmks_rules.hpp.

◆ TraversalInfo() [1/2]

const TraversalInfoType& TraversalInfo ( ) const
inline

Definition at line 124 of file fastmks_rules.hpp.

◆ TraversalInfo() [2/2]

TraversalInfoType& TraversalInfo ( )
inline

Definition at line 125 of file fastmks_rules.hpp.


The documentation for this class was generated from the following file:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-3.2.1/src/mlpack/methods/fastmks/fastmks_rules.hpp