Public Member Functions | Protected Member Functions | Protected Attributes

CPCA Class Reference


Detailed Description

Preprocessor PCACut performs principial component analysis on the input vectors and keeps only the n eigenvectors with eigenvalues above a certain threshold.

On preprocessing the stored covariance matrix is used to project vectors into eigenspace only returning vectors of reduced dimension n. Optional whitening is performed.

This is only useful if the dimensionality of the data is rather low, as the covariance matrix is of size num_feat*num_feat. Note that vectors don't have to have zero mean as it is substracted.

Definition at line 48 of file PCA.h.

Inheritance diagram for CPCA:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CPCA (bool do_whitening=false, EPCAMode mode=FIXED_NUMBER, float64_t thresh=1e-6)
virtual ~CPCA ()
virtual bool init (CFeatures *features)
virtual void cleanup ()
virtual SGMatrix< float64_tapply_to_feature_matrix (CFeatures *features)
virtual SGVector< float64_tapply_to_feature_vector (SGVector< float64_t > vector)
SGMatrix< float64_tget_transformation_matrix ()
SGVector< float64_tget_eigenvalues ()
SGVector< float64_tget_mean ()
virtual const char * get_name () const
virtual EPreprocessorType get_type () const

Protected Member Functions

void init ()

Protected Attributes

SGMatrix< float64_tm_transformation_matrix
int32_t num_dim
int32_t num_old_dim
SGVector< float64_tm_mean_vector
SGVector< float64_tm_eigenvalues_vector
bool m_initialized
bool m_whitening
EPCAMode m_mode
float64_t thresh

Constructor & Destructor Documentation

CPCA ( bool  do_whitening = false,
EPCAMode  mode = FIXED_NUMBER,
float64_t  thresh = 1e-6 
)

constructor

Parameters:
do_whitening do whitening
mode mode of pca
thresh threshold

Definition at line 27 of file PCA.cpp.

~CPCA (  )  [virtual]

destructor

Definition at line 57 of file PCA.cpp.


Member Function Documentation

SGMatrix< float64_t > apply_to_feature_matrix ( CFeatures features  )  [virtual]

apply preprocessor to feature matrix

Parameters:
features features
Returns:
processed feature matrix

Reimplemented from CDimensionReductionPreprocessor.

Definition at line 187 of file PCA.cpp.

SGVector< float64_t > apply_to_feature_vector ( SGVector< float64_t vector  )  [virtual]

apply preprocessor to feature vector

Parameters:
vector feature vector
Returns:
processed feature vector

Reimplemented from CDimensionReductionPreprocessor.

Definition at line 230 of file PCA.cpp.

void cleanup (  )  [virtual]

cleanup

Reimplemented from CDimensionReductionPreprocessor.

Definition at line 180 of file PCA.cpp.

SGVector< float64_t > get_eigenvalues (  ) 

get eigenvalues of PCA

Definition at line 253 of file PCA.cpp.

SGVector< float64_t > get_mean (  ) 

get mean vector of original data

Definition at line 258 of file PCA.cpp.

virtual const char* get_name ( void   )  const [virtual]
Returns:
object name

Reimplemented from CDimensionReductionPreprocessor.

Definition at line 96 of file PCA.h.

SGMatrix< float64_t > get_transformation_matrix (  ) 

get transformation matrix, i.e. eigenvectors (potentially scaled if do_whitening is true)

Definition at line 248 of file PCA.cpp.

virtual EPreprocessorType get_type (  )  const [virtual]
Returns:
a type of preprocessor

Reimplemented from CDimensionReductionPreprocessor.

Definition at line 99 of file PCA.h.

bool init ( CFeatures features  )  [virtual]

initialize preprocessor from features

Parameters:
features 

Reimplemented from CDimensionReductionPreprocessor.

Definition at line 64 of file PCA.cpp.

void init ( void   )  [protected]

default init

Reimplemented from CDimensionReductionPreprocessor.

Definition at line 34 of file PCA.cpp.


Member Data Documentation

eigenvalues vector

Definition at line 116 of file PCA.h.

bool m_initialized [protected]

initialized

Definition at line 118 of file PCA.h.

mean vector

Definition at line 114 of file PCA.h.

EPCAMode m_mode [protected]

PCA mode

Definition at line 122 of file PCA.h.

transformation matrix

Definition at line 108 of file PCA.h.

bool m_whitening [protected]

whitening

Definition at line 120 of file PCA.h.

int32_t num_dim [protected]

num dim

Definition at line 110 of file PCA.h.

int32_t num_old_dim [protected]

num old dim

Definition at line 112 of file PCA.h.

float64_t thresh [protected]

thresh

Definition at line 124 of file PCA.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation