STK++ 0.9.13
STK::Poisson_ljlk< Array > Class Template Reference

The Poisson mixture model Poisson_ljlk is a Poisson model with a probability function of the form. More...

#include <STK_Poisson_ljlk.h>

Inheritance diagram for STK::Poisson_ljlk< Array >:
Inheritance graph

Public Types

typedef PoissonBase< Poisson_ljlk< Array > > Base
 
- Public Types inherited from STK::PoissonBase< Poisson_ljlk< Array > >
typedef IMixtureDensity< Poisson_ljlk< Array > > Base
 
- Public Types inherited from STK::IMixtureDensity< Derived >
typedef hidden::MixtureTraits< Derived >::Array Array
 
typedef hidden::MixtureTraits< Derived >::Parameters Parameters
 
typedef hidden::Traits< Array >::Type Type
 

Public Member Functions

 Poisson_ljlk (int nbCluster)
 default constructor
 
 Poisson_ljlk (Poisson_ljlk const &model)
 copy constructor
 
 ~Poisson_ljlk ()
 destructor
 
void randomInit (CArrayXX const *const &p_tik, CPointX const *const &p_tk)
 Initialize randomly the parameters of the Poisson mixture.
 
bool run (CArrayXX const *const &p_tik, CPointX const *const &p_tk)
 Compute the weighted probabilities.
 
int computeNbFreeParameters () const
 
- Public Member Functions inherited from STK::PoissonBase< Poisson_ljlk< Array > >
Real lambda (int k, int j) const
 
void initializeModelImpl ()
 Initialize the parameters of the model.
 
Real lnComponentProbability (int i, int k) const
 
int impute (int i, int j, Weights const &pk) const
 
Real impute (int i, int j, CArrayXX const *p_tik) const
 
int rand (int i, int j, int k) const
 
void getParameters (Array &params) const
 This function is used in order to get the current values of the lambdas.
 
void writeParameters (CArrayXX const *p_tik, ostream &os) const
 This function can be used to write summary of parameters to the output stream.
 
Array const *constp_data () const
 
int nbCluster () const
 
- Public Member Functions inherited from STK::IMixtureDensity< Derived >
 ~IMixtureDensity ()
 destructor
 
int nbCluster () const
 
int nbSample () const
 
Real lnNbSample () const
 
Array const *constp_data () const
 
Parameters constparam () 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
 
- Public Member Functions inherited from STK::IRecursiveTemplate< Derived >
Derived & asDerived ()
 static cast : return a reference of this with a cast to the derived class.
 
Derived constasDerived () 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 constasPtrDerived () 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.
 

Additional Inherited Members

- Public Attributes inherited from STK::PoissonBase< Poisson_ljlk< Array > >
Parameters param_
 parameters of the derived mixture model.
 
- Protected Member Functions inherited from STK::PoissonBase< Poisson_ljlk< Array > >
 PoissonBase (int nbCluster)
 default constructor
 
 PoissonBase (PoissonBase const &model)
 copy constructor
 
 ~PoissonBase ()
 destructor
 
- Protected Member Functions inherited from STK::IMixtureDensity< Derived >
 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)
 
- Protected Member Functions inherited from STK::IRecursiveTemplate< Derived >
 IRecursiveTemplate ()
 constructor.
 
 ~IRecursiveTemplate ()
 destructor.
 
- Protected Attributes inherited from STK::IMixtureDensity< Derived >
Parameters param_
 parameters of the derived mixture model.
 

Detailed Description

template<class Array>
class STK::Poisson_ljlk< Array >

The Poisson mixture model Poisson_ljlk is a Poisson model with a probability function of the form.

\[
   P(\mathbf{x}=(n_1,\ldots,n_d)|\theta)
    = \sum_{k=1}^K p_k \prod_{j=1}^d e^{-\lambda_{j}\lambda_{k}} \frac{(\lambda_{j}\lambda_{k})^{n_j}}{n_j!}.
\]

Definition at line 70 of file STK_Poisson_ljlk.h.

Member Typedef Documentation

◆ Base

Definition at line 73 of file STK_Poisson_ljlk.h.

Constructor & Destructor Documentation

◆ Poisson_ljlk() [1/2]

template<class Array >
STK::Poisson_ljlk< Array >::Poisson_ljlk ( int  nbCluster)
inline

default constructor

Parameters
nbClusternumber of cluster in the model

Definition at line 80 of file STK_Poisson_ljlk.h.

80: Base(nbCluster) {}
PoissonBase< Poisson_ljlk< Array > > Base

◆ Poisson_ljlk() [2/2]

template<class Array >
STK::Poisson_ljlk< Array >::Poisson_ljlk ( Poisson_ljlk< Array > const model)
inline

copy constructor

Parameters
modelThe model to copy

Definition at line 84 of file STK_Poisson_ljlk.h.

84: Base(model) {}

◆ ~Poisson_ljlk()

template<class Array >
STK::Poisson_ljlk< Array >::~Poisson_ljlk ( )
inline

destructor

Definition at line 86 of file STK_Poisson_ljlk.h.

86{}

Member Function Documentation

◆ computeNbFreeParameters()

template<class Array >
int STK::Poisson_ljlk< Array >::computeNbFreeParameters ( ) const
inline
Returns
the number of free parameters of the model

Definition at line 92 of file STK_Poisson_ljlk.h.

93 { return this->nbCluster()+p_data()->sizeCols();}

References STK::PoissonBase< Poisson_ljlk< Array > >::nbCluster(), and STK::PoissonBase< Poisson_ljlk< Array > >::p_data().

◆ randomInit()

template<class Array >
void STK::Poisson_ljlk< Array >::randomInit ( CArrayXX const *const p_tik,
CPointX const *const p_tk 
)

Initialize randomly the parameters of the Poisson mixture.

Definition at line 98 of file STK_Poisson_ljlk.h.

99{
100 for (int j=p_data()->beginCols(); j< p_data()->endCols(); ++j)
101 {
102 Real m = p_data()->col(j).template cast<Real>().mean();
103 for (int k= p_tik->beginCols(); k < p_tik->endCols(); ++k)
104 {
105 param_.lambdak_[k] = Law::Exponential::rand(m)/param_.lambdaj_[j];
106 }
107 }
108}
virtual Real rand() const
Generate a pseudo Exponential random variate.
Parameters param_
parameters of the derived mixture model.
double Real
STK fundamental type of Real values.

References STK::Law::Exponential::rand().

◆ run()

template<class Array >
bool STK::Poisson_ljlk< Array >::run ( CArrayXX const *const p_tik,
CPointX const *const p_tk 
)

Compute the weighted probabilities.

Definition at line 113 of file STK_Poisson_ljlk.h.

114{
115 param_.lambdaj_ = (Stat::sumByRow(*p_tik).transpose() * (*p_data()))
116 /(Stat::sumByRow(*p_tik) * Stat::sumByRow(*p_data())).sum();
117 param_.lambdak_ = Stat::sumByRow(*p_data()).transpose() * (*p_tik)/(*p_tk);
118 return true;
119}
Arrays::SumOp< Lhs, Rhs >::result_type sum(Lhs const &lhs, Rhs const &rhs)
convenience function for summing two arrays
hidden::FunctorTraits< Derived, SumOp >::Col sumByRow(Derived const &A)

References STK::sum(), and STK::Stat::sumByRow().


The documentation for this class was generated from the following file: