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

Structure encapsulating the parameters of a STK::DiagGaussian_sj 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
 
CPointX sigma_
 standard deviation of the variables
 
Array1D< Stat::Online< CPointX, Real > > stat_mean_
 Array of the mean statistics.
 
Stat::Online< CPointX, Realstat_sigma_
 Array of the standard deviation statistics.
 

Detailed Description

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

Definition at line 182 of file STK_DiagGaussianParameters.h.

Constructor & Destructor Documentation

◆ ModelParameters() [1/2]

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

default constructor

Parameters
nbClusterthe number of class of the mixture

Definition at line 113 of file STK_DiagGaussianParameters.cpp.

114 : mean_(nbCluster), sigma_(nbCluster)
115 , stat_mean_(nbCluster), stat_sigma_(nbCluster)
116{}
Stat::Online< CPointX, Real > stat_sigma_
Array of the standard deviation statistics.
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
CPointX sigma_
standard deviation of the variables

◆ ModelParameters() [2/2]

copy constructor.

Parameters
paramthe parameters to copy.

Definition at line 120 of file STK_DiagGaussianParameters.cpp.

121 : mean_(param.mean_), sigma_(param.sigma_)
122 , stat_mean_(param.stat_mean_), stat_sigma_(param.stat_sigma_)
123{}

◆ ~ModelParameters()

destructor

Definition at line 125 of file STK_DiagGaussianParameters.cpp.

125{}

Member Function Documentation

◆ mean()

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

Definition at line 209 of file STK_DiagGaussianParameters.h.

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

◆ operator=()

copy operator.

Parameters
paramthe parameters to copy.

Definition at line 129 of file STK_DiagGaussianParameters.cpp.

130{
131 mean_ = param.mean_;
132 sigma_ = param.sigma_;
133 stat_mean_ = param.stat_mean_;
134 stat_sigma_ = param.stat_sigma_;
135 return *this;
136}

◆ releaseStatistics()

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

Release the computed statistics.

Definition at line 169 of file STK_DiagGaussianParameters.cpp.

170{
171 for(int k=stat_mean_.begin(); k<stat_mean_.end(); ++k)
172 {
173 stat_mean_[k].release();
174 }
175 stat_sigma_.release();
176}

◆ resize()

resize and initialize the set of parameter.

Parameters
rangerange of the variables in the data set

Definition at line 138 of file STK_DiagGaussianParameters.cpp.

139{
140 for (int k = mean_.begin(); k< mean_.end(); ++k)
141 {
142 mean_[k].resize(range) = 0;
143 stat_mean_[k].resize(range);
144 }
145 sigma_.resize(range) = 1.;
146 stat_sigma_.resize(range);
147}

◆ setParameters()

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

Set the parameters of the mixture model.

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

Definition at line 231 of file STK_DiagGaussianParameters.h.

232 {
233 sigma_ =0.;
234 for(int k=mean_.begin(), kp= params.beginRows(); k<mean_.end(); ++k, kp+=2)
235 {
236 mean_[k] = params.row(kp);
237 sigma_ += params.row(kp+1);
238 }
239 sigma_ /= mean_.size();
240 }

◆ setStatistics()

Set the computed statistics.

Definition at line 158 of file STK_DiagGaussianParameters.cpp.

159{
160 for(int k=stat_mean_.begin(); k<stat_mean_.end(); ++k)
161 {
162 mean_[k] = stat_mean_[k].mean();
163 stat_mean_[k].release();
164 }
165 sigma_ = stat_sigma_.mean();
166 stat_sigma_.release();
167}

◆ sigma()

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

Definition at line 211 of file STK_DiagGaussianParameters.h.

211{ return sigma_[j];}

◆ updateStatistics()

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

update statistics of the parameters.

Definition at line 149 of file STK_DiagGaussianParameters.cpp.

150{
151 for(int k=stat_mean_.begin(); k<stat_mean_.end(); ++k)
152 {
153 stat_mean_[k].update(mean_[k]);
154 }
156}
virtual void update()
update the runner.

Member Data Documentation

◆ mean_

array of size nbCluster with the parameters mean of the variables

Definition at line 185 of file STK_DiagGaussianParameters.h.

◆ sigma_

standard deviation of the variables

Definition at line 187 of file STK_DiagGaussianParameters.h.

◆ stat_mean_

Array of the mean statistics.

Definition at line 189 of file STK_DiagGaussianParameters.h.

◆ stat_sigma_

Array of the standard deviation statistics.

Definition at line 191 of file STK_DiagGaussianParameters.h.


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