Back to FabImage Library website
You are here: Start » Function Reference » Data Classification » Principal Component Analysis » CreatePCATransform

CreatePCATransform
Header: | FIL.h |
---|---|
Namespace: | fil |
Module: | FoundationPro |
Performs the Principal Component Analysis (PCA) on provided data, creates the feature vector and normalization coefficients (mean and standard deviation of variables).
Syntax
C++
C#
void fil::CreatePCATransform ( const fil::Matrix& inMatrix, const int inDimensions, ftl::Optional<float> inVarianceToLeave, fil::PCAModel& outPCAModel, fil::Matrix& outTransformedMatrix, fil::Matrix& diagCovarianceMatrix, fil::Matrix& diagNormalizedData, ftl::Array<int>& diagUsedFeatureIndices )
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. | ||
![]() |
diagUsedFeatureIndices | Array<int>& | Indices of columns in inMatrix, which were used as Principal Components. |
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Cannot conduct PCA on empty matrix in CreatePCATransform. |
DomainError | Cannot conduct principal component analysis for 1-row data set in CreatePCATransform. |
DomainError | Cannot reduce data to less than 1 dimension in CreatePCATransform. |
DomainError | Could not compute eigenvalues and/or eigenvectors in CreatePCATransform. |
DomainError | inDimensions has to be lesser then inMatrix column count in PCA filter in CreatePCATransform. |
DomainError | The process did not converge in CreatePCATransform. |
DomainError | The provided data did not satisfy the prerequisites in CreatePCATransform. |