Back to Adaptive Vision Library website
You are here: Start » Function Reference » Matrix » PCA
PCA
Performs the PCA on provided data, create the feature vector and normalization coefficients (mean and standard deviation of variables)
Syntax
void avl::PCA ( const avl::Matrix& inMatrix, const int inDimensions, atl::Optional<float> inVarianceToLeave, avl::PCAModel& outPCAModel, avl::Matrix& outTransformedMatrix, avl::Matrix& diagCovarianceMatrix, avl::Matrix& diagNormalizedData )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
inMatrix | const Matrix& | Input data, where variables are in column, and examples are in rows. | |||
inDimensions | const int | 1 - | How many data dimensions (variables) to be left in transformed data. | ||
inVarianceToLeave | Optional<float> | 0.0 - 1.0 | 0.95f | How many of input data variance should be left in transformed data; overrides inDimensions input. | |
outPCAModel | PCAModel& | Resulting PCA model. | |||
outTransformedMatrix | Matrix& | Transformed inMatrix with reduced dimensionality. | |||
diagCovarianceMatrix | Matrix& | Covariance matrix of input data. | |||
diagNormalizedData | Matrix& | Input data after normalization: scaling and centering. |
Errors
Error type | Description |
---|---|
DomainError | Cannot conduct PCA on empty matrix! |
DomainError | inDimensions has to be lesser then inMatrix column count in PCA filter! |
DomainError | Cannot reduce data to less than 1 dimension! |
DomainError | Cannot conduct principal component analysis for 1-row data set! |
DomainError | Could not compute eigenvalues and/or eigenvectors. |
DomainError | The provided data did not satisfy the prerequisites. |
DomainError | The process did not converge. |