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

Structure encapsulating the parameters of a Categorical_pjk model. More...

#include <STK_CategoricalParameters.h>

Public Member Functions

 ModelParameters (int nbCluster)
 default constructor
 
 ModelParameters (ModelParameters const &param)
 copy constructor.
 
 ~ModelParameters ()
 destructor
 
ModelParametersoperator= (ModelParameters const &param)
 copy operator.
 
Real constproba (int k, int j, int l) const
 
CVectorX proba (int k, int j) const
 
void resize (Range const &rangeModalities, Range const &rangeCols)
 resize the set of parameter
 
void updateStatistics ()
 update statistics of the parameters.
 
void setStatistics ()
 set and release the computed statistics
 
void releaseStatistics ()
 Set the computed statistics.
 
template<class Array >
void setParameters (ExprBase< Array > const &params)
 Set the parameters of the mixture model.
 

Public Attributes

Array1D< CArrayXXproba_
 array of size nbCluster with the probabilities of the variables
 
Array1D< Stat::Online< CArrayXX, Real > > stat_proba_
 Array of size nbCluster with the statistics of the probabilities.
 

Detailed Description

Structure encapsulating the parameters of a Categorical_pjk model.

Definition at line 54 of file STK_CategoricalParameters.h.

Constructor & Destructor Documentation

◆ ModelParameters() [1/2]

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

default constructor

Parameters
nbClusternumber of class of the mixture

Definition at line 45 of file STK_CategoricalParameters.cpp.

46 : proba_(nbCluster), stat_proba_(nbCluster) {}
Array1D< CArrayXX > proba_
array of size nbCluster with the probabilities of the variables
Array1D< Stat::Online< CArrayXX, Real > > stat_proba_
Array of size nbCluster with the statistics of the probabilities.

◆ ModelParameters() [2/2]

copy constructor.

Parameters
paramthe parameters to copy.

Definition at line 50 of file STK_CategoricalParameters.cpp.

51 : proba_(param.proba_), stat_proba_(param.stat_proba_)
52{}

◆ ~ModelParameters()

Member Function Documentation

◆ operator=()

copy operator.

Parameters
paramthe parameters to copy.

Definition at line 56 of file STK_CategoricalParameters.cpp.

57{
58 proba_ = param.proba_;
59 stat_proba_ = param.stat_proba_;
60 return *this;
61}

◆ proba() [1/2]

CVectorX STK::ModelParameters< Clust::Categorical_pjk_ >::proba ( int  k,
int  j 
) const
inline
Returns
the probabilities of the kth cluster for the jth variable

Definition at line 79 of file STK_CategoricalParameters.h.

79{ return proba_[k].col(j);}

◆ proba() [2/2]

Real const & STK::ModelParameters< Clust::Categorical_pjk_ >::proba ( int  k,
int  j,
int  l 
) const
inline
Returns
the probability of the kth cluster, jth variable, lth modality

Definition at line 77 of file STK_CategoricalParameters.h.

77{ return proba_[k](l,j);}

◆ releaseStatistics()

Set the computed statistics.

Definition at line 91 of file STK_CategoricalParameters.cpp.

92{
93 for(int k=stat_proba_.begin(); k<stat_proba_.end(); ++k)
94 { stat_proba_[k].release();}
95}

◆ resize()

void STK::ModelParameters< Clust::Categorical_pjk_ >::resize ( Range const rangeModalities,
Range const rangeCols 
)

resize the set of parameter

Parameters
rangeModalitiesrange of the modalities
rangeColsrange of the variables

Definition at line 65 of file STK_CategoricalParameters.cpp.

66{
67 for (int k = proba_.begin(); k< proba_.end(); ++k)
68 {
69 proba_[k].resize(rangeModalities, rangeCols) = 1./rangeModalities.size();
70 stat_proba_[k].resize(rangeModalities, rangeCols);
71 }
72}

◆ setParameters()

template<class Array >
void STK::ModelParameters< Clust::Categorical_pjk_ >::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 proabiliteis on consecutive rows. The number of column of params is the number of variables.

Definition at line 100 of file STK_CategoricalParameters.h.

101 {
102 int kp = params.beginRows();
103 for(int k=proba_.begin(); k<proba_.end(); ++k)
104 {
105 for (int l = proba_[k].beginRows(); l < proba_[k].endRows(); ++l, ++kp)
106 {
107 for (int j = proba_[k].beginCols(); j < proba_[k].endCols(); ++j)
108 { proba_[k](l, j) = params(kp , j) ;}
109 }
110 }
111 }

◆ setStatistics()

set and release the computed statistics

Definition at line 81 of file STK_CategoricalParameters.cpp.

82{
83 for(int k=stat_proba_.begin(); k<stat_proba_.end(); ++k)
84 {
85 proba_[k] = stat_proba_[k].mean();
86 stat_proba_[k].release();
87 }
88}

◆ updateStatistics()

update statistics of the parameters.

Definition at line 75 of file STK_CategoricalParameters.cpp.

76{
77 for(int k=stat_proba_.begin(); k<stat_proba_.end(); ++k)
78 { stat_proba_[k].update(proba_[k]);}
79}
virtual void update()
update the runner.

Member Data Documentation

◆ proba_

array of size nbCluster with the probabilities of the variables

Definition at line 57 of file STK_CategoricalParameters.h.

◆ stat_proba_

Array of size nbCluster with the statistics of the probabilities.

Definition at line 59 of file STK_CategoricalParameters.h.


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