.TH "mlpack::fastmks::FastMKS< KernelType, TreeType >" 3 "Tue Sep 9 2014" "Version 1.0.10" "MLPACK" \" -*- nroff -*- .ad l .nh .SH NAME mlpack::fastmks::FastMKS< KernelType, TreeType > \- .PP An implementation of fast exact max-kernel search\&. .SH SYNOPSIS .br .PP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBFastMKS\fP (const arma::mat &\fBreferenceSet\fP, const bool \fBsingle\fP=false, const bool \fBnaive\fP=false)" .br .RI "\fICreate the \fBFastMKS\fP object using the reference set as the query set\&. \fP" .ti -1c .RI "\fBFastMKS\fP (const arma::mat &\fBreferenceSet\fP, const arma::mat &\fBquerySet\fP, const bool \fBsingle\fP=false, const bool \fBnaive\fP=false)" .br .RI "\fICreate the \fBFastMKS\fP object using separate reference and query sets\&. \fP" .ti -1c .RI "\fBFastMKS\fP (const arma::mat &\fBreferenceSet\fP, KernelType &kernel, const bool \fBsingle\fP=false, const bool \fBnaive\fP=false)" .br .RI "\fICreate the \fBFastMKS\fP object using the reference set as the query set, and with an initialized kernel\&. \fP" .ti -1c .RI "\fBFastMKS\fP (const arma::mat &\fBreferenceSet\fP, const arma::mat &\fBquerySet\fP, KernelType &kernel, const bool \fBsingle\fP=false, const bool \fBnaive\fP=false)" .br .RI "\fICreate the \fBFastMKS\fP object using separate reference and query sets, and with an initialized kernel\&. \fP" .ti -1c .RI "\fBFastMKS\fP (const arma::mat &\fBreferenceSet\fP, TreeType *\fBreferenceTree\fP, const bool \fBsingle\fP=false, const bool \fBnaive\fP=false)" .br .RI "\fICreate the \fBFastMKS\fP object with an already-initialized tree built on the reference points\&. \fP" .ti -1c .RI "\fBFastMKS\fP (const arma::mat &\fBreferenceSet\fP, TreeType *\fBreferenceTree\fP, const arma::mat &\fBquerySet\fP, TreeType *\fBqueryTree\fP, const bool \fBsingle\fP=false, const bool \fBnaive\fP=false)" .br .RI "\fICreate the \fBFastMKS\fP object with already-initialized trees built on the reference and query points\&. \fP" .ti -1c .RI "\fB~FastMKS\fP ()" .br .RI "\fIDestructor for the \fBFastMKS\fP object\&. \fP" .ti -1c .RI "const \fBmetric::IPMetric\fP .br < KernelType > & \fBMetric\fP () const " .br .RI "\fIGet the inner-product metric induced by the given kernel\&. \fP" .ti -1c .RI "\fBmetric::IPMetric\fP< KernelType > & \fBMetric\fP ()" .br .RI "\fIModify the inner-product metric induced by the given kernel\&. \fP" .ti -1c .RI "void \fBSearch\fP (const size_t k, arma::Mat< size_t > &indices, arma::mat &products)" .br .RI "\fISearch for the maximum inner products of the query set (or if no query set was passed, the reference set is used)\&. \fP" .ti -1c .RI "std::string \fBToString\fP () const " .br .RI "\fIReturns a string representation of this object\&. \fP" .in -1c .SS "Private Member Functions" .in +1c .ti -1c .RI "void \fBInsertNeighbor\fP (arma::Mat< size_t > &indices, arma::mat &products, const size_t queryIndex, const size_t pos, const size_t neighbor, const double distance)" .br .RI "\fIUtility function\&. Copied too many times from too many places\&. \fP" .in -1c .SS "Private Attributes" .in +1c .ti -1c .RI "\fBmetric::IPMetric\fP< KernelType > \fBmetric\fP" .br .RI "\fIThe instantiated inner-product metric induced by the given kernel\&. \fP" .ti -1c .RI "bool \fBnaive\fP" .br .RI "\fIIf true, naive (brute-force) search is used\&. \fP" .ti -1c .RI "const arma::mat & \fBquerySet\fP" .br .RI "\fIThe query dataset\&. \fP" .ti -1c .RI "TreeType * \fBqueryTree\fP" .br .RI "\fIThe tree built on the query dataset\&. \fP" .ti -1c .RI "const arma::mat & \fBreferenceSet\fP" .br .RI "\fIThe reference dataset\&. \fP" .ti -1c .RI "TreeType * \fBreferenceTree\fP" .br .RI "\fIThe tree built on the reference dataset\&. \fP" .ti -1c .RI "bool \fBsingle\fP" .br .RI "\fIIf true, single-tree search is used\&. \fP" .ti -1c .RI "bool \fBtreeOwner\fP" .br .RI "\fIIf true, this object created the trees and is responsible for them\&. \fP" .in -1c .SH "Detailed Description" .PP .SS "template, tree::FirstPointIsRoot, FastMKSStat>>class mlpack::fastmks::FastMKS< KernelType, TreeType >" An implementation of fast exact max-kernel search\&. Given a query dataset and a reference dataset (or optionally just a reference dataset which is also used as the query dataset), fast exact max-kernel search finds, for each point in the query dataset, the k points in the reference set with maximum kernel value K(p_q, p_r), where k is a specified parameter and K() is a Mercer kernel\&. .PP For more information, see the following paper\&. .PP .PP .nf @inproceedings{curtin2013fast, title={Fast Exact Max-Kernel Search}, author={Curtin, Ryan R\&. and Ram, Parikshit and Gray, Alexander G\&.}, booktitle={Proceedings of the 2013 SIAM International Conference on Data Mining (SDM 13)}, year={2013} } .fi .PP .PP This class allows specification of the type of kernel and also of the type of tree\&. \fBFastMKS\fP can be run on kernels that work on arbitrary objects -- however, this only works with cover trees and other trees that are built only on points in the dataset (and not centroids of regions or anything like that)\&. .PP \fBTemplate Parameters:\fP .RS 4 \fIKernelType\fP Type of kernel to run \fBFastMKS\fP with\&. .br \fITreeType\fP Type of tree to run \fBFastMKS\fP with; it must have metric IPMetric\&. .RE .PP .PP Definition at line 69 of file fastmks\&.hpp\&. .SH "Constructor & Destructor Documentation" .PP .SS "template, tree::FirstPointIsRoot, FastMKSStat>> \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::\fBFastMKS\fP (const arma::mat &referenceSet, const boolsingle = \fCfalse\fP, const boolnaive = \fCfalse\fP)" .PP Create the \fBFastMKS\fP object using the reference set as the query set\&. Optionally, specify whether or not single-tree search or naive (brute-force) search should be used\&. .PP \fBParameters:\fP .RS 4 \fIreferenceSet\fP Set of data to run \fBFastMKS\fP on\&. .br \fIsingle\fP Whether or not to run single-tree search\&. .br \fInaive\fP Whether or not to run brute-force (naive) search\&. .RE .PP .SS "template, tree::FirstPointIsRoot, FastMKSStat>> \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::\fBFastMKS\fP (const arma::mat &referenceSet, const arma::mat &querySet, const boolsingle = \fCfalse\fP, const boolnaive = \fCfalse\fP)" .PP Create the \fBFastMKS\fP object using separate reference and query sets\&. Optionally, specify whether or not single-tree search or naive (brute-force) search should be used\&. .PP \fBParameters:\fP .RS 4 \fIreferenceSet\fP Reference set of data for \fBFastMKS\fP\&. .br \fIquerySet\fP Set of query points for \fBFastMKS\fP\&. .br \fIsingle\fP Whether or not to run single-tree search\&. .br \fInaive\fP Whether or not to run brute-force (naive) search\&. .RE .PP .SS "template, tree::FirstPointIsRoot, FastMKSStat>> \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::\fBFastMKS\fP (const arma::mat &referenceSet, KernelType &kernel, const boolsingle = \fCfalse\fP, const boolnaive = \fCfalse\fP)" .PP Create the \fBFastMKS\fP object using the reference set as the query set, and with an initialized kernel\&. This is useful for when the kernel stores state\&. Optionally, specify whether or not single-tree search or naive (brute-force) search should be used\&. .PP \fBParameters:\fP .RS 4 \fIreferenceSet\fP Reference set of data for \fBFastMKS\fP\&. .br \fIkernel\fP Initialized kernel\&. .br \fIsingle\fP Whether or not to run single-tree search\&. .br \fInaive\fP Whether or not to run brute-force (naive) search\&. .RE .PP .SS "template, tree::FirstPointIsRoot, FastMKSStat>> \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::\fBFastMKS\fP (const arma::mat &referenceSet, const arma::mat &querySet, KernelType &kernel, const boolsingle = \fCfalse\fP, const boolnaive = \fCfalse\fP)" .PP Create the \fBFastMKS\fP object using separate reference and query sets, and with an initialized kernel\&. This is useful for when the kernel stores state\&. Optionally, specify whether or not single-tree search or naive (brute-force) search should be used\&. .PP \fBParameters:\fP .RS 4 \fIreferenceSet\fP Reference set of data for \fBFastMKS\fP\&. .br \fIquerySet\fP Set of query points for \fBFastMKS\fP\&. .br \fIkernel\fP Initialized kernel\&. .br \fIsingle\fP Whether or not to run single-tree search\&. .br \fInaive\fP Whether or not to run brute-force (naive) search\&. .RE .PP .SS "template, tree::FirstPointIsRoot, FastMKSStat>> \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::\fBFastMKS\fP (const arma::mat &referenceSet, TreeType *referenceTree, const boolsingle = \fCfalse\fP, const boolnaive = \fCfalse\fP)" .PP Create the \fBFastMKS\fP object with an already-initialized tree built on the reference points\&. Be sure that the tree is built with the metric type IPMetric\&. For this constructor, the reference set and the query set are the same points\&. Optionally, whether or not to run single-tree search or brute-force (naive) search can be specified\&. .PP \fBParameters:\fP .RS 4 \fIreferenceSet\fP Reference set of data for \fBFastMKS\fP\&. .br \fIreferenceTree\fP Tree built on reference data\&. .br \fIsingle\fP Whether or not to run single-tree search\&. .br \fInaive\fP Whether or not to run brute-force (naive) search\&. .RE .PP .SS "template, tree::FirstPointIsRoot, FastMKSStat>> \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::\fBFastMKS\fP (const arma::mat &referenceSet, TreeType *referenceTree, const arma::mat &querySet, TreeType *queryTree, const boolsingle = \fCfalse\fP, const boolnaive = \fCfalse\fP)" .PP Create the \fBFastMKS\fP object with already-initialized trees built on the reference and query points\&. Be sure that the trees are built with the metric type IPMetric\&. Optionally, whether or not to run single-tree search or naive (brute-force) search can be specified\&. .PP \fBParameters:\fP .RS 4 \fIreferenceSet\fP Reference set of data for \fBFastMKS\fP\&. .br \fIreferenceTree\fP Tree built on reference data\&. .br \fIquerySet\fP Set of query points for \fBFastMKS\fP\&. .br \fIqueryTree\fP Tree built on query data\&. .br \fIsingle\fP Whether or not to use single-tree search\&. .br \fInaive\fP Whether or not to use naive (brute-force) search\&. .RE .PP .SS "template, tree::FirstPointIsRoot, FastMKSStat>> \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::~\fBFastMKS\fP ()" .PP Destructor for the \fBFastMKS\fP object\&. .SH "Member Function Documentation" .PP .SS "template, tree::FirstPointIsRoot, FastMKSStat>> void \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::InsertNeighbor (arma::Mat< size_t > &indices, arma::mat &products, const size_tqueryIndex, const size_tpos, const size_tneighbor, const doubledistance)\fC [private]\fP" .PP Utility function\&. Copied too many times from too many places\&. .SS "template, tree::FirstPointIsRoot, FastMKSStat>> const \fBmetric::IPMetric\fP& \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::Metric () const\fC [inline]\fP" .PP Get the inner-product metric induced by the given kernel\&. .PP Definition at line 193 of file fastmks\&.hpp\&. .PP References mlpack::fastmks::FastMKS< KernelType, TreeType >::metric\&. .SS "template, tree::FirstPointIsRoot, FastMKSStat>> \fBmetric::IPMetric\fP& \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::Metric ()\fC [inline]\fP" .PP Modify the inner-product metric induced by the given kernel\&. .PP Definition at line 195 of file fastmks\&.hpp\&. .PP References mlpack::fastmks::FastMKS< KernelType, TreeType >::metric\&. .SS "template, tree::FirstPointIsRoot, FastMKSStat>> void \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::Search (const size_tk, arma::Mat< size_t > &indices, arma::mat &products)" .PP Search for the maximum inner products of the query set (or if no query set was passed, the reference set is used)\&. The resulting maximum inner products are stored in the products matrix and the corresponding point indices are stores in the indices matrix\&. The results for each point in the query set are stored in the corresponding column of the indices and products matrices; for instance, the index of the point with maximum inner product to point 4 in the query set will be stored in row 0 and column 4 of the indices matrix\&. .PP \fBParameters:\fP .RS 4 \fIk\fP The number of maximum kernels to find\&. .br \fIindices\fP Matrix to store resulting indices of max-kernel search in\&. .br \fIproducts\fP Matrix to store resulting max-kernel values in\&. .RE .PP .SS "template, tree::FirstPointIsRoot, FastMKSStat>> std::string \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::ToString () const" .PP Returns a string representation of this object\&. .SH "Member Data Documentation" .PP .SS "template, tree::FirstPointIsRoot, FastMKSStat>> \fBmetric::IPMetric\fP \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::metric\fC [private]\fP" .PP The instantiated inner-product metric induced by the given kernel\&. .PP Definition at line 223 of file fastmks\&.hpp\&. .PP Referenced by mlpack::fastmks::FastMKS< KernelType, TreeType >::Metric()\&. .SS "template, tree::FirstPointIsRoot, FastMKSStat>> bool \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::naive\fC [private]\fP" .PP If true, naive (brute-force) search is used\&. .PP Definition at line 220 of file fastmks\&.hpp\&. .SS "template, tree::FirstPointIsRoot, FastMKSStat>> const arma::mat& \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::querySet\fC [private]\fP" .PP The query dataset\&. .PP Definition at line 206 of file fastmks\&.hpp\&. .SS "template, tree::FirstPointIsRoot, FastMKSStat>> TreeType* \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::queryTree\fC [private]\fP" .PP The tree built on the query dataset\&. This is NULL if there is no query set\&. .PP Definition at line 212 of file fastmks\&.hpp\&. .SS "template, tree::FirstPointIsRoot, FastMKSStat>> const arma::mat& \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::referenceSet\fC [private]\fP" .PP The reference dataset\&. .PP Definition at line 204 of file fastmks\&.hpp\&. .SS "template, tree::FirstPointIsRoot, FastMKSStat>> TreeType* \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::referenceTree\fC [private]\fP" .PP The tree built on the reference dataset\&. .PP Definition at line 209 of file fastmks\&.hpp\&. .SS "template, tree::FirstPointIsRoot, FastMKSStat>> bool \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::single\fC [private]\fP" .PP If true, single-tree search is used\&. .PP Definition at line 218 of file fastmks\&.hpp\&. .SS "template, tree::FirstPointIsRoot, FastMKSStat>> bool \fBmlpack::fastmks::FastMKS\fP< KernelType, TreeType >::treeOwner\fC [private]\fP" .PP If true, this object created the trees and is responsible for them\&. .PP Definition at line 215 of file fastmks\&.hpp\&. .SH "Author" .PP Generated automatically by Doxygen for MLPACK from the source code\&.