35#ifndef STK_HDGAUSSIAN_AJKBKQKD_H
36#define STK_HDGAUSSIAN_AJKBKQKD_H
38#include "../HDGaussianModels/STK_HDGaussianBase.h"
44template<
class Array>
class HDGaussian_AjkBkQkD;
78 : mean_(param.mean_), sigma_(param.sigma_)
83 inline Real const&
mean(
int k,
int j)
const {
return mean_[k][
j];}
85 inline Real const&
sigma(
int k,
int j)
const {
return sigma_[k][
j];}
89 for (
int k = mean_.begin(); k< mean_.end(); ++k)
90 { mean_[k].resize(range) =0;
91 sigma_[k].resize(range) = 1.;
151 this->randomMean(p_tik);
153 for (
int k= p_tik->beginCols(); k < p_tik->endCols(); ++k)
157#ifdef STK_MIXTURE_VERY_VERBOSE
158 stk_cout <<
_T(
"MixtureHDGaussian_ajk_bk_qk_d<Array>::randomInit( CArrayXX const* const& p_tik, CPointX const* const& p_tk) done\n");
167 if (!this->updateMean(p_tik))
return false;
169 for (
int k= p_tik->beginCols(); k < p_tik->endCols(); ++k)
172#ifdef STK_MIXTURE_DEBUG
173 if( (param_.sigma_[k] <= 0).any() )
175 stk_cout <<
_T(
"MixtureHDGaussian_ajk_bk_qk_d::run() failed\n");
176 stk_cout <<
_T(
"p_tik->col(") << k <<
_T(
") =\n") << p_tik->
col(k).transpose() <<
_T(
"\n");
177 stk_cout <<
_T(
"param_.mean_[") << k <<
_T(
"] =") << param_.mean_[k];
178 stk_cout <<
_T(
"param_.sigma_[") << k <<
_T(
"] =") << param_.sigma_[k];
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
Base class for the diagonal Gaussian models.
Array const *const & p_data() const
Parameters param_
parameters of the derived mixture model.
Base class for the diagonal Gaussian models.
The diagonal Gaussian mixture model HDGaussian_AjkBkQkD is the most general HD Gaussian model and hav...
DiagGaussianBase< HDGaussian_AjkBkQkDk< Array > > Base
Array const *const & p_data() const
int computeNbFreeParameters() const
HDGaussian_AjkBkQkD(HDGaussian_AjkBkQkD const &model)
copy constructor
Parameters param_
parameters of the derived mixture model.
~HDGaussian_AjkBkQkD()
destructor
bool run(CArrayXX const *const &p_tik, CPointX const *const &p_tk)
Compute the weighted mean and the common standard deviation.
Real lnComponentProbability(int i, int k) const
void randomInit(CArrayXX const *const &p_tik, CPointX const *const &p_tk)
Initialize randomly the parameters of the Gaussian mixture.
HDGaussian_AjkBkQkD(int nbCluster)
default constructor
hidden::CSlice< Derived, sizeRows_, 1 >::Result col(int j) const
implement the col operator using a reference on the column of the allocator
virtual Real lpdf(Real const &x) const
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Index sub-vector region: Specialization when the size is unknown.
Arrays::SumOp< Lhs, Rhs >::result_type sum(Lhs const &lhs, Rhs const &rhs)
convenience function for summing two arrays
double Real
STK fundamental type of Real values.
hidden::FunctorTraits< Derived, VarianceWithFixedMeanOp >::Row varianceWithFixedMean(Derived const &A, MeanType const &mean, bool unbiased)
Compute the VarianceWithFixedMean(s) value(s) of A.
The namespace STK is the main domain space of the Statistical ToolKit project.
ModelParameters(int nbCluster)
default constructor
void resize(Range const &range)
resize the set of parameter
~ModelParameters()
destructor
Array1D< CPointX > mean_
array of size nbCluster with the parameters mean of the variables
ModelParameters(ModelParameters const ¶m)
copy constructor.
Real const & sigma(int k, int j) const
Array1D< CPointX > sigma_
standard deviation of the variables
Real const & mean(int k, int j) const
struct storing the parameters of the mixture.
ModelParameters< Clust::HDGaussian_AjkBkQkD_ > Parameters
Type of the structure storing the parameters of a MixturGaussian_sjk model.
Main class for the mixtures traits policy.