123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- /**
- * @file PCA.h
- * @brief extract fourier domain value
- * @author Michael Koch
- * @date 5/27/2008
- */
- #ifndef PCAINCLUDE
- #define PCAINCLUDE
- #ifdef NOVISUAL
- #include <vislearning/nice_nonvis.h>
- #else
- #include <vislearning/nice.h>
- #endif
- #include "vislearning/math/ftransform/FTransform.h"
- namespace OBJREC {
- /** extract PCA features */
- class PCA: public FTransform
- {
- protected:
- NICE::Vector mean;
- NICE::Matrix basis;
- NICE::Matrix normbasis;
-
- NICE::Matrix normalization;
- uint targetDimension;
- uint maxiteration;
- double mindelta;
-
- public:
-
- PCA (uint dim,uint maxiteration=100,double mindelta=1e-4);
- PCA (void);
- NICE::Matrix getBasis();
-
- NICE::Vector getMean();
- void restore (std::istream & is, int format = 0);
- void store (std::ostream & os, int format = 0) const;
- void clear ();
-
- /**
- * get Basis Vectors of PCA
- * @param features Input Features
- * @param dimension Dimension size / number of principal components
- * @param mode Algorithm mode 0=SVD 1=Arnoldi
- * @return Basis Vectors
- */
- void calculateBasis(const NICE::Matrix &features,const uint targetDimension,const uint mode=0);
- void calculateBasis(const NICE::Matrix &features,const uint targetDimension,const uint mode,const bool adaptive,const double targetRatio=1.0);
-
- /**
- * returns the dimension of the transformed features
- * @return feature dim
- */
- int getTargetDim();
-
- /**
- * get Features in PCA Space
- * @param data input data
- * @param normalize normalisation switch
- * @return Features as Vector
- */
- NICE::Vector getFeatureVector(const NICE::Vector &data,const bool normalize=true);
-
-
-
- ~PCA();
- private:
-
- void init (uint dim=10,uint maxiteration=100,double mindelta=1e-4);
-
- };
- } // namespace
- #endif
|