mixmod  3.2.0
Mixture models for clustering and classification
 All Classes Namespaces Files Functions Variables Enumerations Friends
GaussianHDDAParameter.h
1 /***************************************************************************
2  SRC/mixmod/Kernel/Parameter/GaussianHDDAParameter.h description
3  copyright : (C) MIXMOD Team - 2001-2016
4  email : contact@mixmod.org
5  ***************************************************************************/
6 
7 /***************************************************************************
8  This file is part of MIXMOD
9 
10  MIXMOD is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MIXMOD is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with MIXMOD. If not, see <http://www.gnu.org/licenses/>.
22 
23  All informations available on : http://www.mixmod.org
24 ***************************************************************************/
25 #ifndef XEMGAUSSIANHDDAPARAMETER_H
26 #define XEMGAUSSIANHDDAPARAMETER_H
27 
28 #include "mixmod/Kernel/Parameter/GaussianParameter.h"
29 
30 namespace XEM {
31 
32 // pre-declaration
33 class DiagMatrix;
34 class GeneralMatrix;
35 class SymmetricMatrix;
36 
42 
43 public:
44 
47 
49  // called by XEMModel
50  GaussianHDDAParameter(Model * iModel, ModelType * iModelType);
51 
53  // called by XEMStrategyType
54  GaussianHDDAParameter(int64_t iNbCluster, int64_t iPbDimension,
55  ModelType * iModelType, std::string & iFileName);
56 
58  GaussianHDDAParameter(const GaussianHDDAParameter * iParameter);
59 
61  virtual ~GaussianHDDAParameter();
62 
64  virtual void reset();
65 
69  Parameter * clone() const;
70 
74  DiagMatrix ** getTabShape() const;
75 
79  GeneralMatrix ** getTabQ() const;
80 
84  double** getTabA() const;
85 
89  double* getTabB() const;
90 
94  int64_t * getTabD() const;
95 
96  SymmetricMatrix ** getTabGammak() const;
97 
98  double ** getGamma() const;
99 
100  void MStep();
101 
102 
103  // init
104  //-----
105 
107  virtual void initForInitRANDOM();
108 
113  void initForInitUSER_PARTITION(int64_t & nbInitializedCluster,
114  bool * tabNotInitializedCluster, Partition * initPartition);
115 
117  virtual void initUSER(Parameter* iParam);
118 
119  double getLogLikelihoodOne() const;
120 
121  void edit();
122 
123  void edit(std::ofstream & oFile, bool text = false);
124 
125  void recopy(Parameter * otherParameter);
126 
127  double getPdf(int64_t iSample, int64_t kCluster) const;
128 
129  void getAllPdf(double ** tabFik, double * tabProportion) const;
130 
131  double getPdf(Sample * x, int64_t kCluster)const;
132 
133  double* computeLoglikelihoodK(double** K);
134 
135  void input(std::ifstream & fi);
136 
137 protected:
138 
140  DiagMatrix** _tabShape;
141 
143  GeneralMatrix ** _tabQk;
144 
145  int64_t __storeDim;
147  double ** _tabAkj;
149  double * _tabBk;
151  int64_t * _tabDk;
152 
154  SymmetricMatrix ** _tabGammak; // matrice nk * p
156  double ** _Gammak;
157 
158  int64_t getFreeParameter()const;
159 
160  void computeTabWkW();
161 
163  double ** computeCost(GeneralMatrix ** tabQ)const;
164 
166  void computeAkjBkQk();
168  void computeAkjBQk();
170  void computeAjBkQk();
172  void computeAjBQk();
173 
175  void computeAkBkQk();
177  void computeAkBQk();
178 
180  void computeTabDk();
181 };
182 
184  return _tabShape;
185 }
186 
188  return _tabQk;
189 }
190 
191 inline double** GaussianHDDAParameter::getTabA() const {
192  return _tabAkj;
193 }
194 
195 inline double* GaussianHDDAParameter::getTabB() const {
196  return _tabBk;
197 }
198 
199 inline int64_t * GaussianHDDAParameter::getTabD() const {
200  return _tabDk;
201 }
202 
203 inline SymmetricMatrix** GaussianHDDAParameter::getTabGammak() const {
204  return _tabGammak;
205 }
206 
207 inline double ** GaussianHDDAParameter::getGamma() const {
208  return _Gammak;
209 }
210 
211 }
212 
213 #endif
class XEMDiagMatrix
Definition: DiagMatrix.h:40
void computeTabWkW()
Compute table of cluster scattering matrices Wk and W.
Definition: GaussianHDDAParameter.cpp:508
Base class for ModelType(s)
Definition: ModelType.h:37
class GeneralMatrix
Definition: GeneralMatrix.h:40
double ** computeCost(GeneralMatrix **tabQ) const
compute function of cost for each tabQk_k
Definition: GaussianHDDAParameter.cpp:1242
void MStep()
Maximization step method.
Definition: GaussianHDDAParameter.cpp:254
virtual void initUSER(Parameter *iParam)
User initialisation of the parameters of the model.
Definition: GaussianHDDAParameter.cpp:670
Definition: SymmetricMatrix.h:39
int64_t * getTabD() const
Selector.
Definition: GaussianHDDAParameter.h:199
double * getTabB() const
Selector.
Definition: GaussianHDDAParameter.h:195
void computeAjBkQk()
compute parameters for the model AjBkQk
Definition: GaussianHDDAParameter.cpp:1398
void computeAkBkQk()
compute parameters for the model AkBkQk
Definition: GaussianHDDAParameter.cpp:1478
void computeAkjBkQk()
compute parameters for the model AkjBkQk
Definition: GaussianHDDAParameter.cpp:1323
void computeAjBQk()
compute parameters for the model AjBQk
Definition: GaussianHDDAParameter.cpp:1437
void recopy(Parameter *otherParameter)
recopie sans faire construction / destruction
Definition: GaussianHDDAParameter.cpp:707
void computeAkjBQk()
compute parameters for the model AkjBQk
Definition: GaussianHDDAParameter.cpp:1358
Derived class of XEMGaussianParameter for HDDA Gaussian Model(s)
Definition: GaussianHDDAParameter.h:41
double getPdf(int64_t iSample, int64_t kCluster) const
Compute table of sigmas of the samples for each cluster.
Definition: GaussianHDDAParameter.cpp:299
Base class for Partition(s)
Definition: Partition.h:39
Definition: Model.h:50
Base class for XEMGaussianParameter(s)
Definition: GaussianParameter.h:42
DiagMatrix ** getTabShape() const
Selector.
Definition: GaussianHDDAParameter.h:183
GeneralMatrix ** getTabQ() const
Selector.
Definition: GaussianHDDAParameter.h:187
Parameter * clone() const
Selector.
Definition: GaussianHDDAParameter.cpp:246
virtual ~GaussianHDDAParameter()
Destructor.
Definition: GaussianHDDAParameter.cpp:178
double ** getTabA() const
Selector.
Definition: GaussianHDDAParameter.h:191
Base class for Sample.
Definition: Sample.h:41
void computeAkBQk()
compute parameters for the model AkBQk
Definition: GaussianHDDAParameter.cpp:1513
void initForInitUSER_PARTITION(int64_t &nbInitializedCluster, bool *tabNotInitializedCluster, Partition *initPartition)
Definition: GaussianHDDAParameter.cpp:572
void computeTabDk()
compute the intrinsic dimension when non given
Definition: GaussianHDDAParameter.cpp:1006
void input(std::ifstream &fi)
input
Definition: GaussianHDDAParameter.cpp:472
int64_t getFreeParameter() const
Selector.
Definition: GaussianHDDAParameter.cpp:828
virtual void initForInitRANDOM()
initialize attributes before an InitRandom
Definition: GaussianHDDAParameter.cpp:565
virtual void reset()
reset to default values
Definition: GaussianHDDAParameter.cpp:238
GaussianHDDAParameter()
Default constructor.
Definition: GaussianHDDAParameter.cpp:47
Base class for XEMParameter(s)
Definition: Parameter.h:45
double getLogLikelihoodOne() const
get loglikelihood with one cluster
Definition: GaussianHDDAParameter.cpp:726