STK++ 0.9.13
|
Base class for the Categorical models. More...
#include <STK_CategoricalBase.h>
Public Member Functions | |
PointXi const & | nbModalities () const |
Range const & | modalities () const |
Real | proba (int k, int j, int l) const |
CVectorX | proba (int k, int j) const |
void | initializeModelImpl () |
Initialize the model. | |
Real | lnComponentProbability (int i, int k) const |
template<class Weights > | |
int | impute (int i, int j, Weights const &tk) const |
int | rand (int i, int j, int k) const |
template<class Array > | |
void | getParameters (Array ¶ms) const |
This function is used in order to get the current values of the parameters in an array. | |
void | writeParameters (CArrayXX const *p_tik, ostream &os) const |
This function can be used to write summary of parameters to the output stream. | |
![]() | |
~IMixtureDensity () | |
destructor | |
int | nbCluster () const |
int | nbSample () const |
Real | lnNbSample () const |
Array const *const & | p_data () const |
Parameters const & | param () const |
void | setData (Array const &data) |
Set the data set. | |
void | setData (Array const &data, int nbRow, int nbCol, bool byRow=true) |
Set the data set and give dimensions. | |
bool | initializeStep () |
This function will be called at the beginning of the estimation process once the model is created and data is set. | |
void | setParametersStep () |
set the parameters obtained with the intermediate results and release the intermediate results. | |
void | finalizeStep () |
This function will be called once the model is estimated. | |
template<class Weights > | |
Type | sample (int i, int j, Weights const &tk) const |
![]() | |
Derived & | asDerived () |
static cast : return a reference of this with a cast to the derived class. | |
Derived const & | asDerived () const |
static cast : return a const reference of this with a cast to the derived class. | |
Derived * | asPtrDerived () |
static cast : return a ptr on a Derived of this with a cast to the derived class. | |
Derived const * | asPtrDerived () const |
static cast : return a ptr on a constant Derived of this with a cast to the derived class. | |
Derived * | clone () const |
create a leaf using the copy constructor of the Derived class. | |
Derived * | clone (bool isRef) const |
create a leaf using the copy constructor of the Derived class and a flag determining if the clone is a reference or not. | |
Protected Types | |
typedef IMixtureDensity< Derived > | Base |
Protected Member Functions | |
CategoricalBase (int nbCluster) | |
default constructor | |
CategoricalBase (CategoricalBase const &model) | |
copy constructor | |
~CategoricalBase () | |
destructor | |
Array const *const & | p_data () const |
![]() | |
IMixtureDensity (int nbCluster) | |
Default constructor. | |
IMixtureDensity (IMixtureDensity const &model) | |
copy constructor. | |
void | initializeModel () |
Initialize the model before its first use. | |
bool | initializeStepImpl () |
default implementation of initializeStepImpl (do nothing and return true) | |
void | finalizeStepImpl () |
default implementation of finalizeStepImpl (do nothing) | |
void | setNbSample (int nbSample) |
Set the number of sample of the model (needed by kernel models) | |
![]() | |
IRecursiveTemplate () | |
constructor. | |
~IRecursiveTemplate () | |
destructor. | |
Protected Attributes | |
PointXi | nbModalities_ |
Array with the number of modalities of each columns of the data set. | |
Range | modalities_ |
range of the modalities | |
Parameters | param_ |
parameters of the derived mixture model. | |
![]() | |
Parameters | param_ |
parameters of the derived mixture model. | |
Additional Inherited Members | |
![]() | |
typedef hidden::MixtureTraits< Derived >::Array | Array |
typedef hidden::MixtureTraits< Derived >::Parameters | Parameters |
typedef hidden::Traits< Array >::Type | Type |
Base class for the Categorical models.
Definition at line 50 of file STK_CategoricalBase.h.
|
protected |
Definition at line 53 of file STK_CategoricalBase.h.
|
inlineprotected |
default constructor
nbCluster | number of cluster in the model |
Definition at line 60 of file STK_CategoricalBase.h.
|
inlineprotected |
copy constructor
model | The model to copy |
Definition at line 64 of file STK_CategoricalBase.h.
|
inlineprotected |
void STK::CategoricalBase< Derived >::getParameters | ( | Array & | params | ) | const |
This function is used in order to get the current values of the parameters in an array.
[out] | params | the array with the parameters of the mixture. |
Definition at line 195 of file STK_CategoricalBase.h.
References STK::baseIdx.
int STK::CategoricalBase< Derived >::impute | ( | int | i, |
int | j, | ||
Weights const & | tk | ||
) | const |
i,j | indexes of the data to impute |
tk | the probabilities of each class for the ith individual |
Definition at line 155 of file STK_CategoricalBase.h.
|
inline |
Initialize the model.
Resize the probability arrays of each component and compute the number and range of modalities of each variables.
Definition at line 82 of file STK_CategoricalBase.h.
References _R, _T, STK::max(), STK::min(), STK::CategoricalBase< Derived >::modalities_, STK::CategoricalBase< Derived >::nbModalities_, STK::CategoricalBase< Derived >::p_data(), STK::CategoricalBase< Derived >::param_, STK::IArray2D< Derived >::resize(), and stk_cout.
|
inline |
i,k | indexes of the sample and of the component |
Definition at line 140 of file STK_CategoricalBase.h.
References STK::sum().
|
inline |
Definition at line 74 of file STK_CategoricalBase.h.
References STK::CategoricalBase< Derived >::modalities_.
|
inline |
Definition at line 72 of file STK_CategoricalBase.h.
References STK::CategoricalBase< Derived >::nbModalities_.
|
inlineprotected |
Definition at line 131 of file STK_IMixtureDensity.h.
Referenced by STK::CategoricalBase< Derived >::initializeModelImpl().
|
inline |
Definition at line 78 of file STK_CategoricalBase.h.
References STK::CategoricalBase< Derived >::param_.
|
inline |
Definition at line 76 of file STK_CategoricalBase.h.
References STK::CategoricalBase< Derived >::param_.
Referenced by STK::CategoricalBase< Derived >::rand().
|
inline |
i,j,k | indexes of the data to simulate |
Definition at line 115 of file STK_CategoricalBase.h.
References STK::CategoricalBase< Derived >::proba(), and STK::Law::Categorical::rand().
void STK::CategoricalBase< Derived >::writeParameters | ( | CArrayXX const * | p_tik, |
ostream & | os | ||
) | const |
This function can be used to write summary of parameters to the output stream.
p_tik | a constant pointer on the posterior probabilities |
os | Stream where you want to write the summary of parameters. |
Definition at line 176 of file STK_CategoricalBase.h.
References _T.
|
protected |
range of the modalities
Definition at line 133 of file STK_CategoricalBase.h.
Referenced by STK::CategoricalBase< Derived >::initializeModelImpl(), and STK::CategoricalBase< Derived >::modalities().
|
protected |
Array with the number of modalities of each columns of the data set.
Definition at line 131 of file STK_CategoricalBase.h.
Referenced by STK::CategoricalBase< Derived >::initializeModelImpl(), and STK::CategoricalBase< Derived >::nbModalities().
|
protected |
parameters of the derived mixture model.
Should be an instance of the STK::ModelParameters struct.
Definition at line 180 of file STK_IMixtureDensity.h.
Referenced by STK::CategoricalBase< Derived >::initializeModelImpl(), STK::CategoricalBase< Derived >::proba(), and STK::CategoricalBase< Derived >::proba().