36#ifndef STK_IMIXTURESTATMODEL_H
37#define STK_IMIXTURESTATMODEL_H
257 template<
class Array>
266 template<
class Array,
class RowVector>
271 template<
class RowVector>
280 template<
class Manager,
class Parameters>
288 template<
class Manager>
296 template<
class Manager>
303 template<
class Manager>
311 template<
class Manager,
class Parameters>
319 template<
class Manager,
class MissingValues>
347template<
class DataHandler>
351 typedef typename InfoMap::const_iterator const_iterator;
352 for ( const_iterator
it=
manager.p_handler()->info().begin();
it!=
manager.p_handler()->info().end(); ++
it)
355#ifdef STK_MIXTURE_DEBUG
357 {
stk_cout <<
_T(
"In IMixtureStatModel::createMixture(manager) failed.\n");}
369template<
class Manager>
373#ifdef STK_MIXTURE_DEBUG
375 {
stk_cout <<
_T(
"In IMixtureStatModel::createMixture(manager,")<< idData <<
_T(
") failed.\n");}
386template<
class Manager>
390#ifdef STK_MIXTURE_DEBUG
392 {
stk_cout <<
_T(
"In IMixtureStatModel::removeMixture(manager,")<< idData <<
_T(
") failed.\n");}
397 manager.releaseDataBridge( idData);
406template<
class Manager,
class Parameters>
419 for (
int i =
tik_.beginCols();
i<
tik_.endCols(); ++
i)
429template<
class Array,
class RowVector>
432#ifdef STK_MIXTURE_DEBUG
433 if (
pk_.size() !=
tik_.sizeCols())
439 for (
int i =
tik_.beginCols();
i<
tik_.endCols(); ++
i)
448template<
class RowVector>
451#ifdef STK_MIXTURE_DEBUG
463template<
class Manager,
class Parameters>
473template<
class Manager,
class MissingValues>
In this file we define the enum, constants and utilities functions of the Clustering project.
In this file we define the Interface class IMixtureManager.
In this file we define the interface base class IStatModelBase.
#define STKRUNTIME_ERROR_2ARG(Where, Arg1, Arg2, Error)
This file contain the functors computings statistics.
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
std::map< std::string, std::string > InfoMap
hidden::CSlice< Derived, 1, sizeCols_ >::Result row(int i) const
implement the row operator using a reference on the row of the allocator
Interface base class for Mixture (composed) model.
CArrayXX tik_
The tik probabilities.
void setParameters(IMixtureManager< Manager > const &manager, String const &idData, Parameters const ¶m)
Utility method allowing to set the parameters to a specific mixture.
int computeNbMissingValues() const
compute the missing values of the model.
void setMixtureParameters(Array const &tik)
set the mixture parameters using an array of posterior probabilities.
CVectorXi const & zi() const
virtual void writeParameters(ostream &os) const
write the parameters of the model in the stream os.
void setNbCluster(int nbCluster)
set the number of cluster of the model
virtual ~IMixtureStatModel()
destructor
virtual IMixtureStatModel * create() const =0
create pattern
CPointX const & tk() const
void registerMixture(IMixture *p_mixture)
register a mixture to the composer.
CPointX const & pk() const
Real computeLikelihood(int i) const
void setProportions(RowVector const &pk)
Set proportions of each classes.
virtual Real lnComponentProbability(int i, int k) const =0
CVectorXi zi_
The zi class label.
Real computeLnLikelihood() const
void createMixture(IMixtureManager< Manager > &manager)
Utility method allowing to create all the mixtures registered in the data handler of a mixture manage...
virtual IMixtureStatModel * clone() const =0
clone pattern
virtual void initializeStep()
Initialize the model before at its first use.
IMixture * getMixture(String const &idData) const
Utility lookup function allowing to find a Mixture from its idData.
virtual void imputationStep()
Impute the missing values.
virtual void randomInit()=0
initialize randomly the parameters of the components of the model
virtual void setParametersStep()
Utility method allowing to signal to a mixture to set its parameters.
virtual void finalizeStep()
Finalize the estimation of the model.
void releaseMixture(String const &idData)
release a mixture from the composer.
std::vector< IMixture * > const & v_mixtures() const
CArrayXX const & tik() const
void getMissingValues(IMixtureManager< Manager > const &manager, String const &idData, MissingValues &missing) const
Utility method allowing to get the missing values of a specific mixture.
int computeNbFreeParameters() const
compute the number of free parameters of the model.
virtual void releaseIntermediateResults()
This step can be used to signal to the mixtures that they must release the stored results.
std::vector< IMixture * >::const_iterator ConstMixtIterator
std::vector< IMixture * > v_mixtures_
vector of pointers to the mixtures components
virtual void storeIntermediateResults(int iteration)
This step can be used to signal to the mixtures that they must store results.
void removeMixture(IMixtureManager< Manager > &manager, String const &idData)
Utility method allowing to release completely a mixture with its data set.
void getParameters(IMixtureManager< Manager > const &manager, String const &idData, Parameters ¶m) const
Utility method allowing to get the parameters of a specific mixture.
virtual void samplingStep()
Simulation of all the latent variables and/or missing data excluding class labels.
CPointX pk_
The proportions of each mixtures.
std::vector< IMixture * >::iterator MixtIterator
CPointX tk_
The sum of the columns of tik_.
int nbCluster_
number of cluster.
Interface base class for all the mixture models that will be processed by the composer.
Interface base class for all Statistical Models.
void setLnLikelihood(Real const &lnLikelihood)
set the log-likelihood of the model
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.
std::basic_ostream< Char > ostream
ostream for Char
hidden::FunctorTraits< Derived, SumOp >::Row sumByCol(Derived const &A)
The namespace STK is the main domain space of the Statistical ToolKit project.