Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BIAS::PCA Class Reference

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>

+ Collaboration diagram for BIAS::PCA:

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_
 

Detailed Description

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

Author
haertel 01/06

Definition at line 47 of file PCA.hh.

Constructor & Destructor Documentation

BIAS::PCA::PCA ( )
inline

Definition at line 50 of file PCA.hh.

Member Function Documentation

void PCA::ComputeMean ( const std::vector< BIAS::Vector< PCAType > > &  vec,
BIAS::Vector< PCAType > &  mean 
)
void PCA::ComputeReductionMatrix ( const std::vector< BIAS::Vector< PCAType > > &  vec,
BIAS::Matrix< PCAType > &  matrix,
int  reductionSize = -1 
)

Computes a reduction-matrix.

the first dimension of the matrix is taken out of the first vector

Parameters
vecthe input: a vector of data-vectors
matrixthe matrix returned
reductionSizethe second dimension of the matrix

Definition at line 52 of file PCA.cpp.

void PCA::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.

Parameters
vecthe input: a vector of vectors
matrixthe matrix returned
reductionSizethe second dimension of the matrix

Definition at line 33 of file PCA.cpp.

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

Parameters
normalizeset 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 
)
void PCA::GetMean ( BIAS::Vector< PCAType > &  mean)

get mean of a vector

Definition at line 150 of file PCA.cpp.

void BIAS::PCA::GetVariances ( BIAS::Vector< double > &  S)
inline

get eigenvalues of data (call after ComputeReductionMatrix)

Definition at line 102 of file PCA.hh.

void PCA::SetReductionSize ( int  size)
protected

Definition at line 146 of file PCA.cpp.

Member Data Documentation

BIAS::Vector<PCAType> BIAS::PCA::mean_
protected

Definition at line 111 of file PCA.hh.

int BIAS::PCA::reductionSize_
protected

Definition at line 110 of file PCA.hh.

BIAS::Vector<double> BIAS::PCA::S_
protected

Definition at line 112 of file PCA.hh.


The documentation for this class was generated from the following files: