Basic Image AlgorithmS Library
2.8.0
|
principal component analysis on a set of vectors with PCA it is possible to find the most important dimensions of a set of vectors. More...
#include <MathAlgo/PCA.hh>
Public Member Functions | |
void | ComputeMean (const std::vector< BIAS::Vector< PCAType > > &vec, BIAS::Vector< PCAType > &mean) |
computes mean of a set of vectors More... | |
void | ComputeReductionMatrix (const std::vector< BIAS::Vector< PCAType > > &vec, BIAS::Matrix< PCAType > &matrix, int reductionSize=-1) |
Computes a reduction-matrix. More... | |
void | ComputeReductionMatrix (const std::vector< std::vector< BIAS::Vector< PCAType > > > &vec, BIAS::Matrix< PCAType > &matrix, int reductionSize=-1) |
Computes a reduction-matrix this method uses all float-vectors for analyzing. More... | |
void | ComputeReductionMatrix (BIAS::Matrix< PCAType > &cov, BIAS::Matrix< PCAType > &matrix, bool normalize=false, int reductionSize=-1) |
uses scatter matrix cov to compute reduction matrix More... | |
void | ComputeScatter (const std::vector< BIAS::Vector< PCAType > > &vec, const BIAS::Vector< PCAType > &mean, BIAS::Matrix< PCAType > &cov) |
compute unnomalized covariance More... | |
void | GetMean (BIAS::Vector< PCAType > &mean) |
get mean of a vector More... | |
void | GetVariances (BIAS::Vector< double > &S) |
get eigenvalues of data (call after ComputeReductionMatrix) More... | |
PCA () | |
Protected Member Functions | |
void | SetReductionSize (int size) |
Protected Attributes | |
BIAS::Vector< PCAType > | mean_ |
int | reductionSize_ |
BIAS::Vector< double > | S_ |
principal component analysis on a set of vectors with PCA it is possible to find the most important dimensions of a set of vectors.
the dimension can be reduced while the vectors stay separable
void PCA::ComputeMean | ( | const std::vector< BIAS::Vector< PCAType > > & | vec, |
BIAS::Vector< PCAType > & | mean | ||
) |
computes mean of a set of vectors
Definition at line 127 of file PCA.cpp.
References TNT::Vector< T >::newsize(), BIAS::Vector< T >::SetZero(), and TNT::Vector< T >::size().
Referenced by BIAS::LDA::ComputeAnonymousReduction(), and BIAS::LDA::ComputeWithinAndInterClassCovs().
void PCA::ComputeReductionMatrix | ( | const std::vector< BIAS::Vector< PCAType > > & | vec, |
BIAS::Matrix< PCAType > & | matrix, | ||
int | reductionSize = -1 |
||
) |
void PCA::ComputeReductionMatrix | ( | const std::vector< std::vector< BIAS::Vector< PCAType > > > & | vec, |
BIAS::Matrix< PCAType > & | matrix, | ||
int | reductionSize = -1 |
||
) |
void PCA::ComputeReductionMatrix | ( | BIAS::Matrix< PCAType > & | cov, |
BIAS::Matrix< PCAType > & | matrix, | ||
bool | normalize = false , |
||
int | reductionSize = -1 |
||
) |
uses scatter matrix cov to compute reduction matrix
normalize | set to true when you want only the most important directions, set to false if you want to compare distances in reduced space without mahalanobis distance |
Definition at line 72 of file PCA.cpp.
References BIAS::SVD::GetS(), BIAS::SVD::GetVT(), TNT::Matrix< T >::newsize(), BIAS::Matrix< T >::NormalizeRows(), TNT::Matrix< T >::num_cols(), and TNT::Matrix< T >::num_rows().
void PCA::ComputeScatter | ( | const std::vector< BIAS::Vector< PCAType > > & | vec, |
const BIAS::Vector< PCAType > & | mean, | ||
BIAS::Matrix< PCAType > & | cov | ||
) |
compute unnomalized covariance
Definition at line 107 of file PCA.cpp.
References TNT::Matrix< T >::num_cols(), TNT::Matrix< T >::num_rows(), and TNT::Vector< T >::size().
Referenced by BIAS::LDA::ComputeAnonymousReduction(), and BIAS::LDA::ComputeWithinAndInterClassCovs().
void PCA::GetMean | ( | BIAS::Vector< PCAType > & | mean | ) |
|
inline |
|
protected |
|
protected |