template class xf::fintech::PCA¶
#include "pca.hpp"
Overview¶
Class that will compute the Principal Component Analysis of some input data. Data is assumed to be a set of at most MAX_VARS
variables in the rows and at most MAX_OBS
observations in the columns.
Parameters:
DT | The data type to be used |
N | The number of components to select from the PCA . |
NCU | Number of computational units to improve parallelism |
MAX_VARS | Maximum number of synthetisable rows. |
MAX_OBS | Maximum number of synthetisable cols. |
IMPL_METHOD | Choice of implementation method. By default it will use the covariance matrix. |
template < typename DT, unsigned int N, unsigned int NCU, unsigned int MAX_VARS, unsigned int MAX_OBS, pcaImplementationMethod IMPL_METHOD = pcaImplementationMethod::Covariance > class PCA
Methods¶
PCA¶
PCA ( const unsigned int noVars, const unsigned int noObs, DT data [MAX_VARS][MAX_OBS] )
Calculates the core Principal Component Analysis functionality from the provided matrix with the given method.
Parameters:
noVars | Number of variables (rows) in the matrix. |
noObs | Number of observations (cols) in the matrix. |
data | The matrix with the data to be analysed. |
getExplainedVariance¶
void getExplainedVariance (DT values [N])
Gets the N
principal components’ variance of the input data.
Parameters:
values | Vector of N elements wide where the PCA values will be stored. |
getComponents¶
void getComponents (DT vectors [MAX_VARS][N])
Gets the N
principal components of the input data.
Parameters:
vectors | Matrix of MAX_VARS x N elements wide where the principal components will be stored. |