STK++ 0.9.13
STK::ModelParameters< Clust::Gaussian_s_ > Struct Reference

Structure encapsulating the parameters of a STK::DiagGaussian_s model. More...

#include <STK_DiagGaussianParameters.h>

Public Member Functions

 ModelParameters (int nbCluster)
 default constructor
 
 ModelParameters (ModelParameters const &param)
 copy constructor.
 
 ~ModelParameters ()
 destructor
 
ModelParametersoperator= (ModelParameters const &param)
 copy operator.
 
Real constmean (int k, int j) const
 
Real constsigma (int k, int j) const
 
void resize (Range const &range)
 resize and initialize the set of parameter.
 
void updateStatistics ()
 update statistics of the parameters.
 
void setStatistics ()
 Set the computed statistics.
 
void releaseStatistics ()
 Release the computed statistics.
 
template<class Array >
void setParameters (ExprBase< Array > const &params)
 Set the parameters of the mixture model.
 

Public Attributes

Array1D< CPointXmean_
 array of size nbCluster with the parameters mean of the variables
 
Real sigma_
 standard deviation of the variables
 
Array1D< Stat::Online< CPointX, Real > > stat_mean_
 Array of the mean statistics.
 
Stat::Online< Real, Realstat_sigma_
 Array of the standard deviation statistics.
 

Detailed Description

Structure encapsulating the parameters of a STK::DiagGaussian_s model.

Definition at line 247 of file STK_DiagGaussianParameters.h.

Constructor & Destructor Documentation

◆ ModelParameters() [1/2]

STK::ModelParameters< Clust::Gaussian_s_ >::ModelParameters ( int  nbCluster)

default constructor

Parameters
nbClusterthe number of class of the mixture

Definition at line 247 of file STK_DiagGaussianParameters.cpp.

248 : mean_(nbCluster), sigma_(1.)
249 , stat_mean_(nbCluster), stat_sigma_()
250{}
Stat::Online< Real, Real > stat_sigma_
Array of the standard deviation statistics.
Real sigma_
standard deviation of the variables
Array1D< Stat::Online< CPointX, Real > > stat_mean_
Array of the mean statistics.
Array1D< CPointX > mean_
array of size nbCluster with the parameters mean of the variables

◆ ModelParameters() [2/2]

copy constructor.

Parameters
paramthe parameters to copy.

Definition at line 254 of file STK_DiagGaussianParameters.cpp.

255 : mean_(param.mean_), sigma_(param.sigma_)
256 , stat_mean_(param.stat_mean_), stat_sigma_(param.stat_sigma_)
257{}

◆ ~ModelParameters()

destructor

Definition at line 259 of file STK_DiagGaussianParameters.cpp.

259{}

Member Function Documentation

◆ mean()

Real const & STK::ModelParameters< Clust::Gaussian_s_ >::mean ( int  k,
int  j 
) const
inline
Returns
the mean of the kth cluster and jth variable

Definition at line 274 of file STK_DiagGaussianParameters.h.

274{ return mean_[k][j];}

◆ operator=()

copy operator.

Parameters
paramthe parameters to copy.

Definition at line 263 of file STK_DiagGaussianParameters.cpp.

264{
265 mean_ = param.mean_;
266 sigma_ = param.sigma_;
267 stat_mean_ = param.stat_mean_;
268 stat_sigma_ = param.stat_sigma_;
269 return *this;
270}

◆ releaseStatistics()

void STK::ModelParameters< Clust::Gaussian_s_ >::releaseStatistics ( )

Release the computed statistics.

Definition at line 303 of file STK_DiagGaussianParameters.cpp.

304{
305 for(int k=stat_mean_.begin(); k<stat_mean_.end(); ++k)
306 { stat_mean_[k].release();}
307 stat_sigma_.release();
308}

◆ resize()

resize and initialize the set of parameter.

Parameters
rangerange of the variables in the data set

Definition at line 272 of file STK_DiagGaussianParameters.cpp.

273{
274 for (int k = mean_.begin(); k< mean_.end(); ++k)
275 {
276 mean_[k].resize(range) = 0;
277 stat_mean_[k].resize(range);
278 }
279 sigma_ = 1.;
280 stat_sigma_.release();
281}

◆ setParameters()

template<class Array >
void STK::ModelParameters< Clust::Gaussian_s_ >::setParameters ( ExprBase< Array > const params)
inline

Set the parameters of the mixture model.

It is assumed that array params stores for each class the mean and sd parameters on two consecutive rows. The number of column of params is the number of variables.

Definition at line 296 of file STK_DiagGaussianParameters.h.

297 {
298 sigma_ =0.;
299 for(int k=mean_.begin(), kp= params.beginRows(); k<mean_.end(); ++k, kp+=2)
300 {
301 mean_[k] = params.row(kp);
302 sigma_ += params.row(kp+1).mean();
303 }
304 sigma_ /= mean_.size();
305 }

◆ setStatistics()

Set the computed statistics.

Definition at line 292 of file STK_DiagGaussianParameters.cpp.

293{
294 for(int k=stat_mean_.begin(); k<stat_mean_.end(); ++k)
295 {
296 mean_[k] = stat_mean_[k].mean();
297 stat_mean_[k].release();
298 }
299 sigma_ = stat_sigma_.mean();
300 stat_sigma_.release();
301}

◆ sigma()

Real const & STK::ModelParameters< Clust::Gaussian_s_ >::sigma ( int  k,
int  j 
) const
inline
Returns
the standard deviation of the kth cluster and jth variable

Definition at line 276 of file STK_DiagGaussianParameters.h.

276{ return sigma_;}

◆ updateStatistics()

void STK::ModelParameters< Clust::Gaussian_s_ >::updateStatistics ( )

update statistics of the parameters.

Definition at line 283 of file STK_DiagGaussianParameters.cpp.

284{
285 for(int k=stat_mean_.begin(); k<stat_mean_.end(); ++k)
286 {
287 stat_mean_[k].update(mean_[k]);
288 }
290}
virtual void update()
update the runner.

Member Data Documentation

◆ mean_

array of size nbCluster with the parameters mean of the variables

Definition at line 250 of file STK_DiagGaussianParameters.h.

◆ sigma_

standard deviation of the variables

Definition at line 252 of file STK_DiagGaussianParameters.h.

◆ stat_mean_

Array of the mean statistics.

Definition at line 254 of file STK_DiagGaussianParameters.h.

◆ stat_sigma_

Array of the standard deviation statistics.

Definition at line 256 of file STK_DiagGaussianParameters.h.


The documentation for this struct was generated from the following files: