GaussianMixture.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00029
00030 #ifndef __PDF_H
00031 #define __PDF_H
00032
00033 #include "Gaussian.h"
00034 #include "Discrete.h"
00035
00036 using namespace MipBaselib;
00037 using namespace arma;
00038
00039 namespace MipBaselib{
00040
00042
00043
00044
00048 class GaussianComponent:public Gaussian{
00049 public:
00050 Decimal weight;
00051
00053 GaussianComponent();
00054
00056 GaussianComponent(const GaussianComponent& a);
00057
00059 GaussianComponent(Gaussian g, Decimal w);
00060
00062 GaussianComponent(DCol m, DMat &c, Decimal w=0.0);
00063
00065 GaussianComponent& operator=(const GaussianComponent& a);
00066
00069 virtual string print();
00070 };
00071
00072
00076 class GaussianMixture:public vector<GaussianComponent>{
00077 private:
00078
00079 bool _expectedValueComputed;
00080 bool _covarianceComputed;
00081 bool _normalized;
00082
00083 DCol _expectedValue;
00084 DMat _covariance;
00085
00086 void _computeExpectedValue();
00087
00088 void _computeCovariance();
00089
00090 public:
00091
00093 bool normalized();
00094
00099 void normalize();
00100
00102 GaussianMixture();
00103
00105 DCol expectedValue();
00106
00110 Decimal covariance(int row, int col);
00111
00114 Decimal evaluate(DCol p);
00115
00118 string print();
00119 };
00120
00121
00122
00123
00127 class GaussianComponentID:public GaussianComponent{
00128 public:
00129 int id;
00130
00132 GaussianComponentID();
00133
00135 GaussianComponentID(const GaussianComponentID& a);
00136
00138 GaussianComponentID(Gaussian &g, Decimal w, int ide);
00139
00141 GaussianComponentID(DCol &m, DMat &c, Decimal w=0.0, int ide=0);
00142
00146 GaussianComponentID(stringstream &ss);
00147
00149 GaussianComponentID& operator=(const GaussianComponentID& a);
00150
00153 virtual string print() const;
00154
00157 string exportAsString() const;
00158 };
00159
00160
00164 class GaussianMixtureID:public vector<GaussianComponentID>{
00165 private:
00166
00167 bool _expectedValueComputed;
00168 bool _covarianceComputed;
00169 bool _normalized;
00170
00171 DCol _expectedValue;
00172 DMat _covariance;
00173
00174 void _computeExpectedValue();
00175
00176 void _computeCovariance();
00177
00178 public:
00179
00181 bool normalized();
00182
00187 void normalize();
00188
00190 GaussianMixtureID();
00191
00193 GaussianMixtureID(stringstream& ss);
00194
00196 GaussianMixtureID(string& s);
00197
00199 DCol expectedValue();
00200
00204 Decimal covariance(int row, int col);
00205
00208 Decimal evaluate(DCol p);
00209
00212 string print() const;
00213
00216 string exportAsString() const;
00217 };
00218
00219
00220
00221
00222
00226 class GaussianComponentJointDiscrete: public GaussianComponent, public Discrete{
00227
00228 public:
00229 inline GaussianComponent* _thisGC(){ return (GaussianComponent*)this; }
00230 inline Discrete* _thisD(){ return (Discrete*)this; }
00231
00232 public:
00233
00235 GaussianComponentJointDiscrete();
00236
00240 GaussianComponentJointDiscrete(GaussianComponent gc, Discrete d);
00241
00244 GaussianComponentJointDiscrete(const GaussianComponentJointDiscrete &gcjd);
00245
00248 GaussianComponentJointDiscrete(stringstream &ss);
00249
00252 GaussianComponentJointDiscrete& operator=(const GaussianComponentJointDiscrete &gcjd);
00253
00255 string exportAsString();
00256 };
00257
00258
00259
00263 class GaussianMixtureJointId:public vector<GaussianComponentJointDiscrete>{
00264 private:
00265
00266 bool _expectedValueComputed;
00267 bool _covarianceComputed;
00268 bool _normalized;
00269
00270 DCol _expectedValue;
00271 DMat _covariance;
00272
00273 void _computeExpectedValue();
00274
00275 void _computeCovariance();
00276
00277 public:
00278
00279
00281 bool normalized();
00282
00287 void normalize();
00288
00290 GaussianMixtureJointId();
00291
00294 GaussianMixtureJointId(stringstream &ss);
00295
00298 GaussianMixtureJointId(string &s);
00299
00301 DCol expectedValue();
00302
00306 Decimal covariance(int row, int col);
00307
00310 Decimal evaluate(DCol p);
00311
00314 string print();
00315
00318 string exportAsString();
00319 };
00320
00321
00322 }
00323
00324
00325 #endif
00326
00327
00328
00329
00330
00331
00332
00333