STK++ 0.9.13
STK_IMixture.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------*/
2/* Copyright (C) 2004-2016 Serge Iovleff
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this program; if not, write to the
16 Free Software Foundation, Inc.,
17 59 Temple Place,
18 Suite 330,
19 Boston, MA 02111-1307
20 USA
21
22 Contact : S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
23*/
24
25/*
26 * Project: stkpp::Clustering
27 * created on: 14 nov. 2013
28 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 * Originally created by Parmeet Bhatia <b..._DOT_p..._AT_gmail_Dot_com>
30 **/
31
32
33#ifndef STK_IMIXTURE_H
34#define STK_IMIXTURE_H
35
45
46namespace STK
47{
48
49class IMixtureStatModel;
50
65{
66 public:
72 IMixture( String const& idData = String());
77 IMixture( IMixture const& mixture);
79 virtual ~IMixture();
80
82 inline String const& idData() const { return idData_;}
84 inline IMixtureStatModel const* const p_composer() const { return p_composer_;}
85
90
97 virtual IMixture* clone() const = 0;
103 virtual IMixture* create() const = 0;
113 virtual void initializeStep() = 0;
117 virtual void randomInit() = 0;
121 virtual void paramUpdateStep() = 0;
132 virtual int nbFreeParameter() const = 0;
136 virtual int nbMissingValues() const = 0;
140 virtual void imputationStep() {}
146 virtual void samplingStep() {};
163 virtual void setParametersStep() {}
167 virtual void finalizeStep() {}
171 inline virtual void writeParameters(std::ostream& out) const
172 {
173#ifdef STK_MIXTURE_DEBUG
174 stk_cout<< _T("You need to override this method in your mixture!");
175#endif
176 }
177
178 protected:
182 int nbSample() const;
186 int nbCluster() const;
191 CPointX const* p_pk() const;
195 CPointX const* p_tk() const;
199 CArrayXX const* p_tik() const;
203 CVectorXi const* p_zi() const;
204
205 private:
210};
211
212} // namespace STK
213
214#endif /* STK_IMIXTURE_H */
In this file we implement the final class CArrayNumber.
In this file we implement the final class CArrayPoint.
In this file we implement the final class CArrayVector.
In this file we implement the final class CArray.
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
Interface base class for Mixture (composed) model.
Interface base class for all the mixture models that will be processed by the composer.
CPointX const * p_pk() const
This function can be used in derived classes to get estimated number of individuals from the framewor...
virtual int nbMissingValues() const =0
This function must return the number of missing value in data set identified by idData_.
virtual Real lnComponentProbability(int sample_num, int Cluster_num)=0
This function must be defined to return the posterior probability (PDF) for corresponding sample_num ...
virtual void paramUpdateStep()=0
This function is equivalent to mStep and must be defined to update parameters.
virtual void setParametersStep()
set the parameters of the model.
const IMixtureStatModel * p_composer_
pointer on the main composer model
virtual int nbFreeParameter() const =0
This function must return the number of free parameters.
virtual IMixture * create() const =0
This is a standard create function in usual sense.
CPointX const * p_tk() const
This function can be used in derived classes to get proportions from the framework.
String idData_
Id name of the mixture.
virtual void randomInit()=0
This function should be used in order to initialize randomly the parameters of the mixture.
CVectorXi const * p_zi() const
This function can be used in derived classes to get class labels from the framework.
virtual void finalizeStep()
This step can be used by developer to finalize any thing.
virtual void initializeStep()=0
This function must be defined in derived class for initialization of the mixture parameters.
virtual IMixture * clone() const =0
This is a standard clone function in usual sense.
virtual ~IMixture()
Virtual destructor.
virtual void releaseIntermediateResults()
This step can be used to signal to the mixtures that they must release the stored results.
IMixtureStatModel const *const p_composer() const
virtual void imputationStep()
This function should be used for Imputation of data.
void setMixtureModel(IMixtureStatModel const *p_composer)
set the mixture composer to the mixture
virtual void writeParameters(std::ostream &out) const
This function can be used to write summary of parameters on to the output stream.
CArrayXX const * p_tik() const
This function can be used in derived classes to get posterior probabilities from the framework.
virtual void storeIntermediateResults(int iteration)
This function should be used to store any intermediate results during various iterations after the bu...
String const & idData() const
int nbCluster() const
This function can be used in derived classes to get number of classes.
int nbSample() const
This function can be used in derived classes to get number of samples.
virtual void samplingStep()
This function must be defined for simulation of all the latent variables and/or missing data excludin...
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
std::basic_string< Char > String
STK fundamental type of a String.
double Real
STK fundamental type of Real values.
The namespace STK is the main domain space of the Statistical ToolKit project.