Back to Adaptive Vision Library websiteYou are here:
Start »
Function Reference »
Principal Component Analysis »
CreatePCATransform
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 avl::CreatePCATransform
(
const avl::Matrix& inMatrix,
const int inDimensions,
atl::Optional<float> inVarianceToLeave,
avl::PCAModel& outPCAModel,
avl::Matrix& outTransformedMatrix,
avl::Matrix& diagCovarianceMatrix,
avl::Matrix& diagNormalizedData,
atl::Array<int>& diagUsedFeatureIndices
)
void CreatePCATransform
(
Matrix inMatrix,
int inDimensions,
float? inVarianceToLeave,
out PCAModel outPCAModel,
out Matrix outTransformedMatrix,
out Matrix diagCovarianceMatrix,
out Matrix diagNormalizedData,
out 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
Error type |
Description |
DomainError |
Cannot conduct PCA on empty matrix in CreatePCATransform. |
DomainError |
inDimensions has to be lesser then inMatrix column count in PCA filter in CreatePCATransform. |
DomainError |
Cannot reduce data to less than 1 dimension in CreatePCATransform. |
DomainError |
Cannot conduct principal component analysis for 1-row data set in CreatePCATransform. |
DomainError |
Could not compute eigenvalues and/or eigenvectors in CreatePCATransform. |
DomainError |
The provided data did not satisfy the prerequisites in CreatePCATransform. |
DomainError |
The process did not converge in CreatePCATransform. |