.TH "mlpack::pca::PCA" 3 "Tue Sep 9 2014" "Version 1.0.10" "MLPACK" \" -*- nroff -*- .ad l .nh .SH NAME mlpack::pca::PCA \- .PP This class implements principal components analysis (\fBPCA\fP)\&. .SH SYNOPSIS .br .PP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBPCA\fP (const bool \fBscaleData\fP=false)" .br .RI "\fICreate the \fBPCA\fP object, specifying if the data should be scaled in each dimension by standard deviation when \fBPCA\fP is performed\&. \fP" .ti -1c .RI "void \fBApply\fP (const arma::mat &data, arma::mat &transformedData, arma::vec &eigval, arma::mat &eigvec) const " .br .RI "\fIApply Principal Component Analysis to the provided data set\&. \fP" .ti -1c .RI "void \fBApply\fP (const arma::mat &data, arma::mat &transformedData, arma::vec &eigVal) const " .br .RI "\fIApply Principal Component Analysis to the provided data set\&. \fP" .ti -1c .RI "double \fBApply\fP (arma::mat &data, const size_t newDimension) const " .br .RI "\fIUse \fBPCA\fP for dimensionality reduction on the given dataset\&. \fP" .ti -1c .RI "double \fBApply\fP (arma::mat &data, const int newDimension) const " .br .RI "\fIThis overload is here to make sure int gets casted right to size_t\&. \fP" .ti -1c .RI "double \fBApply\fP (arma::mat &data, const double varRetained) const " .br .RI "\fIUse \fBPCA\fP for dimensionality reduction on the given dataset\&. \fP" .ti -1c .RI "bool \fBScaleData\fP () const " .br .RI "\fIGet whether or not this \fBPCA\fP object will scale (by standard deviation) the data when \fBPCA\fP is performed\&. \fP" .ti -1c .RI "bool & \fBScaleData\fP ()" .br .RI "\fIModify whether or not this \fBPCA\fP object will scale (by standard deviation) the data when \fBPCA\fP is performed\&. \fP" .ti -1c .RI "std::string \fBToString\fP () const " .br .in -1c .SS "Private Attributes" .in +1c .ti -1c .RI "bool \fBscaleData\fP" .br .RI "\fIWhether or not the data will be scaled by standard deviation when \fBPCA\fP is performed\&. \fP" .in -1c .SH "Detailed Description" .PP This class implements principal components analysis (\fBPCA\fP)\&. This is a common, widely-used technique that is often used for either dimensionality reduction or transforming data into a better basis\&. Further information on \fBPCA\fP can be found in almost any statistics or machine learning textbook, and all over the internet\&. .PP Definition at line 38 of file pca\&.hpp\&. .SH "Constructor & Destructor Documentation" .PP .SS "mlpack::pca::PCA::PCA (const boolscaleData = \fCfalse\fP)" .PP Create the \fBPCA\fP object, specifying if the data should be scaled in each dimension by standard deviation when \fBPCA\fP is performed\&. .PP \fBParameters:\fP .RS 4 \fIscaleData\fP Whether or not to scale the data\&. .RE .PP .SH "Member Function Documentation" .PP .SS "void mlpack::pca::PCA::Apply (const arma::mat &data, arma::mat &transformedData, arma::vec &eigval, arma::mat &eigvec) const" .PP Apply Principal Component Analysis to the provided data set\&. It is safe to pass the same matrix reference for both data and transformedData\&. .PP \fBParameters:\fP .RS 4 \fIdata\fP Data matrix\&. .br \fItransformedData\fP Matrix to put results of \fBPCA\fP into\&. .br \fIeigval\fP Vector to put eigenvalues into\&. .br \fIeigvec\fP Matrix to put eigenvectors (loadings) into\&. .RE .PP .PP Referenced by Apply()\&. .SS "void mlpack::pca::PCA::Apply (const arma::mat &data, arma::mat &transformedData, arma::vec &eigVal) const" .PP Apply Principal Component Analysis to the provided data set\&. It is safe to pass the same matrix reference for both data and transformedData\&. .PP \fBParameters:\fP .RS 4 \fIdata\fP Data matrix\&. .br \fItransformedData\fP Matrix to store results of \fBPCA\fP in\&. .br \fIeigval\fP Vector to put eigenvalues into\&. .RE .PP .SS "double mlpack::pca::PCA::Apply (arma::mat &data, const size_tnewDimension) const" .PP Use \fBPCA\fP for dimensionality reduction on the given dataset\&. This will save the newDimension largest principal components of the data and remove the rest\&. The parameter returned is the amount of variance of the data that is retained; this is a value between 0 and 1\&. For instance, a value of 0\&.9 indicates that 90% of the variance present in the data was retained\&. .PP \fBParameters:\fP .RS 4 \fIdata\fP Data matrix\&. .br \fInewDimension\fP New dimension of the data\&. .RE .PP \fBReturns:\fP .RS 4 Amount of the variance of the data retained (between 0 and 1)\&. .RE .PP .SS "double mlpack::pca::PCA::Apply (arma::mat &data, const intnewDimension) const\fC [inline]\fP" .PP This overload is here to make sure int gets casted right to size_t\&. .PP Definition at line 89 of file pca\&.hpp\&. .PP References Apply()\&. .SS "double mlpack::pca::PCA::Apply (arma::mat &data, const doublevarRetained) const" .PP Use \fBPCA\fP for dimensionality reduction on the given dataset\&. This will save as many dimensions as necessary to retain at least the given amount of variance (specified by parameter varRetained)\&. The amount should be between 0 and 1; if the amount is 0, then only 1 dimension will be retained\&. If the amount is 1, then all dimensions will be retained\&. .PP The method returns the actual amount of variance retained, which will always be greater than or equal to the varRetained parameter\&. .PP \fBParameters:\fP .RS 4 \fIdata\fP Data matrix\&. .br \fIvarRetained\fP Lower bound on amount of variance to retain; should be between 0 and 1\&. .RE .PP \fBReturns:\fP .RS 4 Actual amount of variance retained (between 0 and 1)\&. .RE .PP .SS "bool mlpack::pca::PCA::ScaleData () const\fC [inline]\fP" .PP Get whether or not this \fBPCA\fP object will scale (by standard deviation) the data when \fBPCA\fP is performed\&. .PP Definition at line 113 of file pca\&.hpp\&. .PP References scaleData\&. .SS "bool& mlpack::pca::PCA::ScaleData ()\fC [inline]\fP" .PP Modify whether or not this \fBPCA\fP object will scale (by standard deviation) the data when \fBPCA\fP is performed\&. .PP Definition at line 116 of file pca\&.hpp\&. .PP References scaleData\&. .SS "std::string mlpack::pca::PCA::ToString () const" .SH "Member Data Documentation" .PP .SS "bool mlpack::pca::PCA::scaleData\fC [private]\fP" .PP Whether or not the data will be scaled by standard deviation when \fBPCA\fP is performed\&. .PP Definition at line 124 of file pca\&.hpp\&. .PP Referenced by ScaleData()\&. .SH "Author" .PP Generated automatically by Doxygen for MLPACK from the source code\&.