Back to Adaptive Vision Library website

You are here: Start » Function Reference » Data Classification » Principal Component Analysis » CreatePCATransform

CreatePCATransform


Header: AVL.h
Namespace: avl
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 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
)

Parameters

Name Type Range Default Description
Input value
inMatrix const Matrix& Input data, where variables are in column, and examples are in rows.
Input value
inDimensions const int 1 - How many data dimensions (variables) to be left in transformed data.
Input value
inVarianceToLeave Optional<float> 0.0 - 1.0 0.95f How many of input data variance should be left in transformed data; overrides inDimensions input.
Output value
outPCAModel PCAModel& Resulting PCA model.
Output value
outTransformedMatrix Matrix& Transformed inMatrix with reduced dimensionality.
Diagnostic input
diagCovarianceMatrix Matrix& Covariance matrix of input data.
Diagnostic input
diagNormalizedData Matrix& Input data after normalization: scaling and centering.
Diagnostic input
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.