.TH "mlpack::tree::CosineTree" 3 "Tue Sep 9 2014" "Version 1.0.10" "MLPACK" \" -*- nroff -*- .ad l .nh .SH NAME mlpack::tree::CosineTree \- .SH SYNOPSIS .br .PP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBCosineTree\fP (const arma::mat &\fBdataset\fP)" .br .RI "\fI\fBCosineTree\fP constructor for the root node of the tree\&. \fP" .ti -1c .RI "\fBCosineTree\fP (\fBCosineTree\fP &parentNode, const std::vector< size_t > &subIndices)" .br .RI "\fI\fBCosineTree\fP constructor for nodes other than the root node of the tree\&. \fP" .ti -1c .RI "\fBCosineTree\fP (const arma::mat &\fBdataset\fP, const double \fBepsilon\fP, const double \fBdelta\fP)" .br .RI "\fIConstruct the \fBCosineTree\fP and the basis for the given matrix, and passed 'epsilon' and 'delta' parameters\&. \fP" .ti -1c .RI "void \fBBasisVector\fP (arma::vec &bVector)" .br .RI "\fISet the basis vector of the node\&. \fP" .ti -1c .RI "arma::vec & \fBBasisVector\fP ()" .br .RI "\fIGet the basis vector of the node\&. \fP" .ti -1c .RI "size_t \fBBinarySearch\fP (arma::vec &cDistribution, double value, size_t start, size_t end)" .br .RI "\fISample a column based on the cumulative Length-Squared distribution of the cosine node, and a randomly generated value in the range [0, 1]\&. \fP" .ti -1c .RI "void \fBCalculateCentroid\fP ()" .br .RI "\fICalculate centroid of the columns present in the node\&. \fP" .ti -1c .RI "void \fBCalculateCosines\fP (arma::vec &cosines)" .br .RI "\fICalculate cosines of the columns present in the node, with respect to the sampled splitting point\&. \fP" .ti -1c .RI "arma::vec & \fBCentroid\fP ()" .br .RI "\fIGet pointer to the centroid vector\&. \fP" .ti -1c .RI "size_t \fBColumnSampleLS\fP ()" .br .RI "\fISample a point from the Length-Squared distribution of the cosine node\&. \fP" .ti -1c .RI "void \fBColumnSamplesLS\fP (std::vector< size_t > &sampledIndices, arma::vec &probabilities, size_t numSamples)" .br .RI "\fISample 'numSamples' points from the Length-Squared distribution of the cosine node\&. \fP" .ti -1c .RI "void \fBConstructBasis\fP (\fBCosineNodeQueue\fP &treeQueue)" .br .RI "\fIConstructs the final basis matrix, after the cosine tree construction\&. \fP" .ti -1c .RI "void \fBCosineNodeSplit\fP ()" .br .RI "\fIThis function splits the cosine node into two children based on the cosines of the columns contained in the node, with respect to the sampled splitting point\&. \fP" .ti -1c .RI "double \fBFrobNormSquared\fP () const " .br .RI "\fIGet the Frobenius norm squared of columns in the node\&. \fP" .ti -1c .RI "const arma::mat & \fBGetDataset\fP () const " .br .RI "\fIGet pointer to the dataset matrix\&. \fP" .ti -1c .RI "void \fBGetFinalBasis\fP (arma::mat &finalBasis)" .br .RI "\fIReturns the basis of the constructed subspace\&. \fP" .ti -1c .RI "void \fBL2Error\fP (const double error)" .br .RI "\fISet the Monte Carlo error\&. \fP" .ti -1c .RI "double \fBL2Error\fP () const " .br .RI "\fIGet the Monte Carlo error\&. \fP" .ti -1c .RI "\fBCosineTree\fP * \fBLeft\fP ()" .br .RI "\fIGet pointer to the left child of the node\&. \fP" .ti -1c .RI "void \fBModifiedGramSchmidt\fP (\fBCosineNodeQueue\fP &treeQueue, arma::vec &\fBcentroid\fP, arma::vec &newBasisVector, arma::vec *addBasisVector=NULL)" .br .RI "\fICalculates the orthonormalization of the passed centroid, with respect to the current vector subspace\&. \fP" .ti -1c .RI "double \fBMonteCarloError\fP (\fBCosineTree\fP *node, \fBCosineNodeQueue\fP &treeQueue, arma::vec *addBasisVector1=NULL, arma::vec *addBasisVector2=NULL)" .br .RI "\fIEstimates the squared error of the projection of the input node's matrix onto the current vector subspace\&. \fP" .ti -1c .RI "size_t \fBNumColumns\fP () const " .br .RI "\fIGet number of columns of input matrix in the node\&. \fP" .ti -1c .RI "\fBCosineTree\fP * \fBRight\fP ()" .br .RI "\fIGet pointer to the right child of the node\&. \fP" .ti -1c .RI "size_t \fBSplitPointIndex\fP () const " .br .RI "\fIGet the column index of split point of the node\&. \fP" .ti -1c .RI "std::vector< size_t > & \fBVectorIndices\fP ()" .br .RI "\fIGet the indices of columns in the node\&. \fP" .in -1c .SS "Private Attributes" .in +1c .ti -1c .RI "arma::mat \fBbasis\fP" .br .RI "\fISubspace basis of the input dataset\&. \fP" .ti -1c .RI "arma::vec \fBbasisVector\fP" .br .RI "\fIOrthonormalized basis vector of the node\&. \fP" .ti -1c .RI "arma::vec \fBcentroid\fP" .br .RI "\fICentroid of columns of input matrix in the node\&. \fP" .ti -1c .RI "const arma::mat & \fBdataset\fP" .br .RI "\fIMatrix for which cosine tree is constructed\&. \fP" .ti -1c .RI "double \fBdelta\fP" .br .RI "\fICumulative probability for Monte Carlo error lower bound\&. \fP" .ti -1c .RI "double \fBepsilon\fP" .br .RI "\fIError tolerance fraction for calculated subspace\&. \fP" .ti -1c .RI "double \fBfrobNormSquared\fP" .br .RI "\fIFrobenius norm squared of columns in the node\&. \fP" .ti -1c .RI "std::vector< size_t > \fBindices\fP" .br .RI "\fIIndices of columns of input matrix in the node\&. \fP" .ti -1c .RI "double \fBl2Error\fP" .br .RI "\fIMonte Carlo error for this node\&. \fP" .ti -1c .RI "arma::vec \fBl2NormsSquared\fP" .br .RI "\fIL2-norm squared of columns in the node\&. \fP" .ti -1c .RI "\fBCosineTree\fP * \fBleft\fP" .br .RI "\fILeft child of the node\&. \fP" .ti -1c .RI "size_t \fBnumColumns\fP" .br .RI "\fINumber of columns of input matrix in the node\&. \fP" .ti -1c .RI "\fBCosineTree\fP * \fBparent\fP" .br .RI "\fIParent of the node\&. \fP" .ti -1c .RI "\fBCosineTree\fP * \fBright\fP" .br .RI "\fIRight child of the node\&. \fP" .ti -1c .RI "size_t \fBsplitPointIndex\fP" .br .RI "\fIIndex of split point of cosine node\&. \fP" .in -1c .SH "Detailed Description" .PP Definition at line 40 of file cosine_tree\&.hpp\&. .SH "Constructor & Destructor Documentation" .PP .SS "mlpack::tree::CosineTree::CosineTree (const arma::mat &dataset)" .PP \fBCosineTree\fP constructor for the root node of the tree\&. It initializes the necessary variables required for splitting of the node, and building the tree further\&. It takes a pointer to the input matrix and calculates the relevant variables using it\&. .PP \fBParameters:\fP .RS 4 \fIdataset\fP Matrix for which cosine tree is constructed\&. .RE .PP .SS "mlpack::tree::CosineTree::CosineTree (\fBCosineTree\fP &parentNode, const std::vector< size_t > &subIndices)" .PP \fBCosineTree\fP constructor for nodes other than the root node of the tree\&. It takes in a pointer to the parent node and a list of column indices which mentions the columns to be included in the node\&. The function calculate the relevant variables just like the constructor above\&. .PP \fBParameters:\fP .RS 4 \fIparentNode\fP Pointer to the parent cosine node\&. .br \fIsubIndices\fP Pointer to vector of column indices to be included\&. .RE .PP .SS "mlpack::tree::CosineTree::CosineTree (const arma::mat &dataset, const doubleepsilon, const doubledelta)" .PP Construct the \fBCosineTree\fP and the basis for the given matrix, and passed 'epsilon' and 'delta' parameters\&. The \fBCosineTree\fP is constructed by splitting nodes in the direction of maximum error, stored using a priority queue\&. Basis vectors are added from the left and right children of the split node\&. The basis vector from a node is the orthonormalized centroid of its columns\&. The splitting continues till the Monte Carlo estimate of the input matrix's projection on the obtained subspace is less than a fraction of the norm of the input matrix\&. .PP \fBParameters:\fP .RS 4 \fIdataset\fP Matrix for which the \fBCosineTree\fP is constructed\&. .br \fIepsilon\fP Error tolerance fraction for calculated subspace\&. .br \fIdelta\fP Cumulative probability for Monte Carlo error lower bound\&. .RE .PP .SH "Member Function Documentation" .PP .SS "void mlpack::tree::CosineTree::BasisVector (arma::vec &bVector)\fC [inline]\fP" .PP Set the basis vector of the node\&. .PP Definition at line 194 of file cosine_tree\&.hpp\&. .PP References basisVector\&. .SS "arma::vec& mlpack::tree::CosineTree::BasisVector ()\fC [inline]\fP" .PP Get the basis vector of the node\&. .PP Definition at line 197 of file cosine_tree\&.hpp\&. .PP References basisVector\&. .SS "size_t mlpack::tree::CosineTree::BinarySearch (arma::vec &cDistribution, doublevalue, size_tstart, size_tend)" .PP Sample a column based on the cumulative Length-Squared distribution of the cosine node, and a randomly generated value in the range [0, 1]\&. Binary search is more efficient than searching linearly for the same\&. This leads a significant speedup when there are large number of columns to choose from and when a number of samples are to be drawn from the distribution\&. .PP \fBParameters:\fP .RS 4 \fIcDistribution\fP Cumulative LS distibution of columns in the node\&. .br \fIvalue\fP Randomly generated value in the range [0, 1]\&. .br \fIstart\fP Starting index of the distribution interval to search in\&. .br \fIend\fP Ending index of the distribution interval to search in\&. .RE .PP .SS "void mlpack::tree::CosineTree::CalculateCentroid ()" .PP Calculate centroid of the columns present in the node\&. The calculated centroid is used as a basis vector for the cosine tree being constructed\&. .SS "void mlpack::tree::CosineTree::CalculateCosines (arma::vec &cosines)" .PP Calculate cosines of the columns present in the node, with respect to the sampled splitting point\&. The calculated cosine values are useful for splitting the node into its children\&. .PP \fBParameters:\fP .RS 4 \fIcosines\fP Vector to store the cosine values in\&. .RE .PP .SS "arma::vec& mlpack::tree::CosineTree::Centroid ()\fC [inline]\fP" .PP Get pointer to the centroid vector\&. .PP Definition at line 191 of file cosine_tree\&.hpp\&. .PP References centroid\&. .SS "size_t mlpack::tree::CosineTree::ColumnSampleLS ()" .PP Sample a point from the Length-Squared distribution of the cosine node\&. The function uses 'l2NormsSquared' to calculate the cumulative probability distribution of the column vectors\&. The sampling is based on a randomly generated value in the range [0, 1]\&. .SS "void mlpack::tree::CosineTree::ColumnSamplesLS (std::vector< size_t > &sampledIndices, arma::vec &probabilities, size_tnumSamples)" .PP Sample 'numSamples' points from the Length-Squared distribution of the cosine node\&. The function uses 'l2NormsSquared' to calculate the cumulative probability distribution of the column vectors\&. The sampling is based on a randomly generated values in the range [0, 1]\&. .SS "void mlpack::tree::CosineTree::ConstructBasis (\fBCosineNodeQueue\fP &treeQueue)" .PP Constructs the final basis matrix, after the cosine tree construction\&. .PP \fBParameters:\fP .RS 4 \fItreeQueue\fP Priority queue of cosine nodes\&. .RE .PP .SS "void mlpack::tree::CosineTree::CosineNodeSplit ()" .PP This function splits the cosine node into two children based on the cosines of the columns contained in the node, with respect to the sampled splitting point\&. The function also calls the \fBCosineTree\fP constructor for the children\&. .SS "double mlpack::tree::CosineTree::FrobNormSquared () const\fC [inline]\fP" .PP Get the Frobenius norm squared of columns in the node\&. .PP Definition at line 209 of file cosine_tree\&.hpp\&. .PP References frobNormSquared\&. .SS "const arma::mat& mlpack::tree::CosineTree::GetDataset () const\fC [inline]\fP" .PP Get pointer to the dataset matrix\&. .PP Definition at line 179 of file cosine_tree\&.hpp\&. .PP References dataset\&. .SS "void mlpack::tree::CosineTree::GetFinalBasis (arma::mat &finalBasis)\fC [inline]\fP" .PP Returns the basis of the constructed subspace\&. .PP Definition at line 176 of file cosine_tree\&.hpp\&. .PP References basis\&. .SS "void mlpack::tree::CosineTree::L2Error (const doubleerror)\fC [inline]\fP" .PP Set the Monte Carlo error\&. .PP Definition at line 185 of file cosine_tree\&.hpp\&. .PP References l2Error\&. .PP Referenced by mlpack::tree::CompareCosineNode::operator()()\&. .SS "double mlpack::tree::CosineTree::L2Error () const\fC [inline]\fP" .PP Get the Monte Carlo error\&. .PP Definition at line 188 of file cosine_tree\&.hpp\&. .PP References l2Error\&. .SS "\fBCosineTree\fP* mlpack::tree::CosineTree::Left ()\fC [inline]\fP" .PP Get pointer to the left child of the node\&. .PP Definition at line 200 of file cosine_tree\&.hpp\&. .PP References left\&. .SS "void mlpack::tree::CosineTree::ModifiedGramSchmidt (\fBCosineNodeQueue\fP &treeQueue, arma::vec ¢roid, arma::vec &newBasisVector, arma::vec *addBasisVector = \fCNULL\fP)" .PP Calculates the orthonormalization of the passed centroid, with respect to the current vector subspace\&. .PP \fBParameters:\fP .RS 4 \fItreeQueue\fP Priority queue of cosine nodes\&. .br \fIcentroid\fP Centroid of the node being added to the basis\&. .br \fInewBasisVector\fP Orthonormalized centroid of the node\&. .br \fIaddBasisVector\fP Address to additional basis vector\&. .RE .PP .SS "double mlpack::tree::CosineTree::MonteCarloError (\fBCosineTree\fP *node, \fBCosineNodeQueue\fP &treeQueue, arma::vec *addBasisVector1 = \fCNULL\fP, arma::vec *addBasisVector2 = \fCNULL\fP)" .PP Estimates the squared error of the projection of the input node's matrix onto the current vector subspace\&. A normal distribution is fit using weighted norms of projections of samples drawn from the input node's matrix columns\&. The error is calculated as the difference between the Frobenius norm of the input node's matrix and lower bound of the normal distribution\&. .PP \fBParameters:\fP .RS 4 \fInode\fP Node for which Monte Carlo estimate is calculated\&. .br \fItreeQueue\fP Priority queue of cosine nodes\&. .br \fIaddBasisVector1\fP Address to first additional basis vector\&. .br \fIaddBasisVector2\fP Address to second additional basis vector\&. .RE .PP .SS "size_t mlpack::tree::CosineTree::NumColumns () const\fC [inline]\fP" .PP Get number of columns of input matrix in the node\&. .PP Definition at line 206 of file cosine_tree\&.hpp\&. .PP References numColumns\&. .SS "\fBCosineTree\fP* mlpack::tree::CosineTree::Right ()\fC [inline]\fP" .PP Get pointer to the right child of the node\&. .PP Definition at line 203 of file cosine_tree\&.hpp\&. .PP References right\&. .SS "size_t mlpack::tree::CosineTree::SplitPointIndex () const\fC [inline]\fP" .PP Get the column index of split point of the node\&. .PP Definition at line 212 of file cosine_tree\&.hpp\&. .PP References indices, and splitPointIndex\&. .SS "std::vector& mlpack::tree::CosineTree::VectorIndices ()\fC [inline]\fP" .PP Get the indices of columns in the node\&. .PP Definition at line 182 of file cosine_tree\&.hpp\&. .PP References indices\&. .SH "Member Data Documentation" .PP .SS "arma::mat mlpack::tree::CosineTree::basis\fC [private]\fP" .PP Subspace basis of the input dataset\&. .PP Definition at line 222 of file cosine_tree\&.hpp\&. .PP Referenced by GetFinalBasis()\&. .SS "arma::vec mlpack::tree::CosineTree::basisVector\fC [private]\fP" .PP Orthonormalized basis vector of the node\&. .PP Definition at line 236 of file cosine_tree\&.hpp\&. .PP Referenced by BasisVector()\&. .SS "arma::vec mlpack::tree::CosineTree::centroid\fC [private]\fP" .PP Centroid of columns of input matrix in the node\&. .PP Definition at line 234 of file cosine_tree\&.hpp\&. .PP Referenced by Centroid()\&. .SS "const arma::mat& mlpack::tree::CosineTree::dataset\fC [private]\fP" .PP Matrix for which cosine tree is constructed\&. .PP Definition at line 216 of file cosine_tree\&.hpp\&. .PP Referenced by GetDataset()\&. .SS "double mlpack::tree::CosineTree::delta\fC [private]\fP" .PP Cumulative probability for Monte Carlo error lower bound\&. .PP Definition at line 220 of file cosine_tree\&.hpp\&. .SS "double mlpack::tree::CosineTree::epsilon\fC [private]\fP" .PP Error tolerance fraction for calculated subspace\&. .PP Definition at line 218 of file cosine_tree\&.hpp\&. .SS "double mlpack::tree::CosineTree::frobNormSquared\fC [private]\fP" .PP Frobenius norm squared of columns in the node\&. .PP Definition at line 244 of file cosine_tree\&.hpp\&. .PP Referenced by FrobNormSquared()\&. .SS "std::vector mlpack::tree::CosineTree::indices\fC [private]\fP" .PP Indices of columns of input matrix in the node\&. .PP Definition at line 230 of file cosine_tree\&.hpp\&. .PP Referenced by SplitPointIndex(), and VectorIndices()\&. .SS "double mlpack::tree::CosineTree::l2Error\fC [private]\fP" .PP Monte Carlo error for this node\&. .PP Definition at line 242 of file cosine_tree\&.hpp\&. .PP Referenced by L2Error()\&. .SS "arma::vec mlpack::tree::CosineTree::l2NormsSquared\fC [private]\fP" .PP L2-norm squared of columns in the node\&. .PP Definition at line 232 of file cosine_tree\&.hpp\&. .SS "\fBCosineTree\fP* mlpack::tree::CosineTree::left\fC [private]\fP" .PP Left child of the node\&. .PP Definition at line 228 of file cosine_tree\&.hpp\&. .PP Referenced by Left()\&. .SS "size_t mlpack::tree::CosineTree::numColumns\fC [private]\fP" .PP Number of columns of input matrix in the node\&. .PP Definition at line 240 of file cosine_tree\&.hpp\&. .PP Referenced by NumColumns()\&. .SS "\fBCosineTree\fP* mlpack::tree::CosineTree::parent\fC [private]\fP" .PP Parent of the node\&. .PP Definition at line 224 of file cosine_tree\&.hpp\&. .SS "\fBCosineTree\fP* mlpack::tree::CosineTree::right\fC [private]\fP" .PP Right child of the node\&. .PP Definition at line 226 of file cosine_tree\&.hpp\&. .PP Referenced by Right()\&. .SS "size_t mlpack::tree::CosineTree::splitPointIndex\fC [private]\fP" .PP Index of split point of cosine node\&. .PP Definition at line 238 of file cosine_tree\&.hpp\&. .PP Referenced by SplitPointIndex()\&. .SH "Author" .PP Generated automatically by Doxygen for MLPACK from the source code\&.