16 #ifndef MLPACK_METHODS_PCA_DECOMPOSITION_POLICIES_EXACT_SVD_METHOD_HPP 17 #define MLPACK_METHODS_PCA_DECOMPOSITION_POLICIES_EXACT_SVD_METHOD_HPP 41 void Apply(
const arma::mat& data,
42 const arma::mat& centeredData,
43 arma::mat& transformedData,
53 if (data.n_rows < data.n_cols)
57 arma::svd_econ(eigvec, eigVal, v, centeredData,
'l');
61 arma::svd(eigvec, eigVal, v, centeredData);
67 eigVal %= eigVal / (data.n_cols - 1);
70 transformedData = arma::trans(eigvec) * centeredData;
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
Implementation of the exact SVD policy.
void Apply(const arma::mat &data, const arma::mat ¢eredData, arma::mat &transformedData, arma::vec &eigVal, arma::mat &eigvec, const size_t)
Apply Principal Component Analysis to the provided data set using the exact SVD method.