00001 #ifndef ANALYZER_H
00002 #define ANALYZER_H
00003
00004 #include <list>
00005 #include <matrix/newmatio.h>
00006 #include <matrix/newmat.h>
00007 #include <matrix/newmatap.h>
00008 #include "ExampleModel.h"
00009 #include "ReferenceModel.h"
00010
00011 using namespace std;
00012
00013 namespace model {
00014
00033 class Analyzer {
00034 private:
00035 Matrix m_ExampleData;
00036 Matrix m_mean;
00037 Matrix m_AdjustedData;
00038 Matrix m_Covariance;
00039 SymmetricMatrix m_EigenValues;
00040 Matrix m_EigenVectors;
00041 Matrix m_TotalEnergy;
00042 Matrix m_Components;
00043 Matrix m_Transformation;
00044 int N,M;
00045 ReferenceModel m_refModel;
00046
00047 public:
00048 Analyzer();
00049 ~Analyzer();
00050
00063 enum e_PCAMode {
00064 ALL,
00065 JACOBI,
00066 HOUSEHOLDER,
00067 OTHER
00068 };
00069
00070
00071 Analyzer(const Analyzer& other);
00072 Analyzer& operator=(const Analyzer& other);
00073
00074 void mergeData(ReferenceModel refModel, vector<ExampleModel*> lmodels, int size);
00075 void mergeData(ReferenceModel refModel, vector<ExampleModel*> lmodels);
00076 void mean();
00077 void adjust();
00078 void covariance();
00079 void findComponents();
00080 void findComponents(e_PCAMode mode);
00081 void selectComponents();
00082 void computeEnergy();
00083
00084 void setData(Matrix data);
00085 void transformation();
00086
00087 int getInputDimension();
00088 ReferenceModel getModel();
00089 ReferenceModel getModel(Matrix input);
00090
00091 bool save(char* filename);
00092 bool load(char* filename);
00093 };
00094
00100 }
00101 #endif //ANALYZER_H