11 mlpack::pca::PCA pca_data(scale_data);
12 mat transformed_data, eigvec;
13 vec eigval, percent_variance;
15 pca_data.Apply(data, transformed_data, eigval, eigvec);
18 throw std::runtime_error(
"MLPACKPCAData::Apply()");
20 double eigval_sum = sum(eigval);
21 percent_variance = eigval / eigval_sum;
22 percent_variance /= 0.01;
24 AddMatrix(
"Projection", transformed_data, QStringList());
25 AddMatrix(
"Loadings", eigvec, QStringList());
26 AddMatrix(
"Eigenvalues", eigval, QStringList());
27 AddMatrix(
"Percent Variance", percent_variance, QStringList());
void AddMatrix(const QString &key, const mat &value, QStringList column_headings=QStringList())
MlpackPCAData(QString name)
void Apply(const mat &data, bool scale_data)
The AnalysisResults class A container for a mat object that allows a mat to be copied to a heap-alloc...