00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MARSYAS_GMMCLASSIFIER_H
00020 #define MARSYAS_GMMCLASSIFIER_H
00021
00022 #include "MarSystem.h"
00023 #include <vector>
00024
00025 namespace Marsyas
00026 {
00063 class GMMClassifier: public MarSystem
00064 {
00065 private:
00066 mrs_real factor_;
00067
00068 mrs_natural labelRow_;
00069
00070 std::vector<realvec> probs_;
00071 std::vector<realvec> ssprobs_;
00072
00073 std::vector<realvec> vars_;
00074 std::vector<realvec> covars_;
00075 std::vector<realvec> means_;
00076 std::vector<realvec> omeans_;
00077 std::vector<realvec> weights_;
00078
00079 realvec trainMatrix_;
00080 realvec likelihoods_;
00081 realvec classSizes_;
00082 realvec accumVec_;
00083 realvec temp_;
00084 realvec sprobs_;
00085 realvec sum_;
00086
00087 mrs_string prev_mode_;
00088 MarControlPtr ctrl_mode_;
00089
00090 MarControlPtr ctrl_nClasses_;
00091
00092 mrs_natural featSize_;
00093 mrs_natural classSize_;
00094 mrs_natural nMixtures_;
00095 mrs_natural iterations_;
00096 mrs_natural kiterations_;
00097 mrs_natural eiterations_;
00098 MarControlPtr ctrl_nMixtures_;
00099 MarControlPtr ctrl_iterations_;
00100 MarControlPtr ctrl_kiterations_;
00101 MarControlPtr ctrl_eiterations_;
00102
00103 void initialize();
00104 mrs_real gaussian(mrs_natural cl, mrs_natural k, realvec& vec);
00105 void doEM();
00106 void addControls();
00107 void myUpdate(MarControlPtr sender);
00108
00109 public:
00110 GMMClassifier(std::string name);
00111 GMMClassifier(const GMMClassifier& a);
00112 ~GMMClassifier();
00113 MarSystem* clone() const;
00114
00115 void myProcess(realvec& in, realvec& out);
00116 };
00117
00118 }
00119
00120 #endif
00121
00122
00123