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 39 of file PCACut.h.
Public Member Functions | |
CPCACut (int32_t do_whitening=0, float64_t thresh=1e-6) | |
virtual | ~CPCACut () |
virtual bool | init (CFeatures *f) |
initialize preprocessor from features | |
virtual void | cleanup () |
cleanup | |
virtual float64_t * | apply_to_feature_matrix (CFeatures *f) |
virtual float64_t * | apply_to_feature_vector (float64_t *f, int32_t &len) |
virtual const char * | get_name () |
Protected Attributes | |
double * | T |
int32_t | num_dim |
int32_t | num_old_dim |
float64_t * | mean |
bool | initialized |
true when already initialized | |
int32_t | do_whitening |
float64_t | thresh |
constructor
do_whitening | do whitening | |
thresh | threshold |
Definition at line 30 of file PCACut.cpp.
~CPCACut | ( | ) | [virtual] |
Definition at line 36 of file PCACut.cpp.
apply preproc on feature matrix result in feature matrix return pointer to feature_matrix, i.e. f->get_feature_matrix();
Implements CSimplePreProc< float64_t >.
Definition at line 186 of file PCACut.cpp.
apply preproc on single feature vector result in feature matrix
Implements CSimplePreProc< float64_t >.
Definition at line 228 of file PCACut.cpp.
void cleanup | ( | ) | [virtual] |
cleanup
initialize preprocessor from features
Implements CPreProc.
Definition at line 177 of file PCACut.cpp.
virtual const char* get_name | ( | ) | [virtual] |
bool init | ( | CFeatures * | f | ) | [virtual] |
initialize preprocessor from features
compute mean
A = 1.0*xy^T+A blas
Implements CPreProc.
Definition at line 43 of file PCACut.cpp.
int32_t do_whitening [protected] |
bool initialized [protected] |
int32_t num_old_dim [protected] |