SHOGUN
v1.1.0
|
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.
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_t > | apply_to_feature_matrix (CFeatures *features) |
virtual SGVector< float64_t > | apply_to_feature_vector (SGVector< float64_t > vector) |
SGMatrix< float64_t > | get_transformation_matrix () |
SGVector< float64_t > | get_eigenvalues () |
SGVector< float64_t > | get_mean () |
virtual const char * | get_name () const |
virtual EPreprocessorType | get_type () const |
Protected Member Functions | |
void | init () |
Protected Attributes | |
SGMatrix< float64_t > | m_transformation_matrix |
int32_t | num_dim |
int32_t | num_old_dim |
SGVector< float64_t > | m_mean_vector |
SGVector< float64_t > | m_eigenvalues_vector |
bool | m_initialized |
bool | m_whitening |
EPCAMode | m_mode |
float64_t | thresh |
CPCA | ( | bool | do_whitening = false , |
EPCAMode | mode = FIXED_NUMBER , |
||
float64_t | thresh = 1e-6 |
||
) |
SGMatrix< float64_t > apply_to_feature_matrix | ( | CFeatures * | features | ) | [virtual] |
apply preprocessor to feature matrix
features | features |
Reimplemented from CDimensionReductionPreprocessor.
SGVector< float64_t > apply_to_feature_vector | ( | SGVector< float64_t > | vector | ) | [virtual] |
apply preprocessor to feature vector
vector | feature vector |
Reimplemented from CDimensionReductionPreprocessor.
void cleanup | ( | ) | [virtual] |
SGVector< float64_t > get_eigenvalues | ( | ) |
virtual const char* get_name | ( | ) | const [virtual] |
Reimplemented from CDimensionReductionPreprocessor.
virtual EPreprocessorType get_type | ( | ) | const [virtual] |
Reimplemented from CDimensionReductionPreprocessor.
initialize preprocessor from features
features |
Reimplemented from CDimensionReductionPreprocessor.
void init | ( | ) | [protected] |
default init
Reimplemented from CDimensionReductionPreprocessor.
SGVector<float64_t> m_eigenvalues_vector [protected] |
bool m_initialized [protected] |
SGVector<float64_t> m_mean_vector [protected] |
SGMatrix<float64_t> m_transformation_matrix [protected] |
bool m_whitening [protected] |
int32_t num_old_dim [protected] |