35#ifndef STK_DIAGGAUSSIAN_S_H
36#define STK_DIAGGAUSSIAN_S_H
38#include "../DiagGaussianModels/STK_DiagGaussianBase.h"
44template<
class Array>
class DiagGaussian_s;
104 this->randomMean(p_tik);
107 for (
int k= p_tik->beginCols(); k < p_tik->endCols(); ++k)
109 variance += ( p_tik->
col(k).transpose()
114 param_.sigma_ = std::sqrt(variance/(this->nbSample()*p_data()->sizeCols()));
115#ifdef STK_MIXTURE_VERY_VERBOSE
116 stk_cout <<
_T(
"Gaussian_s<Array>::randomInit( CArrayXX const* const& p_tik, CPointX const* const& p_tk) done\n");
125 if (!this->updateMean(p_tik))
return false;
128 for (
int k= p_tik->beginCols(); k < p_tik->endCols(); ++k)
130 variance += ( p_tik->
col(k).transpose()
135 param_.sigma_ = std::sqrt(variance/(this->nbSample()*p_data()->sizeCols()));
136#ifdef STK_MIXTURE_DEBUG
137 if( param_.sigma_ <= 0 )
139 stk_cout <<
_T(
"DiagGaussian_s::run() failed\n");
140 stk_cout <<
_T(
"param_.mean_ =") << param_.mean_;
141 stk_cout <<
_T(
"param_.sigma_=") << param_.sigma_ <<
_T(
"\n");
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
Define the constant point.
Base class for the diagonal Gaussian models.
Array const *const & p_data() const
Parameters param_
parameters of the derived mixture model.
The diagonal DiagGaussian_s mixture model hse a density function of the form.
DiagGaussianBase< DiagGaussian_s< Array > > Base
bool run(CArrayXX const *const &p_tik, CPointX const *const &p_tk)
Compute the weighted mean and the common standard deviation.
void randomInit(CArrayXX const *const &p_tik, CPointX const *const &p_tk)
Initialize randomly the parameters of the Gaussian mixture.
DiagGaussian_s(DiagGaussian_s const &model)
copy constructor
~DiagGaussian_s()
destructor
DiagGaussian_s(int nbCluster)
default constructor
int computeNbFreeParameters() const
hidden::CSlice< Derived, sizeRows_, 1 >::Result col(int j) const
implement the col operator using a reference on the column of the allocator
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
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.
The namespace STK is the main domain space of the Statistical ToolKit project.
ModelParameters< Clust::Gaussian_s_ > Parameters
Type of the structure storing the mixture parameters.
Main class for the mixtures traits policy.