34#ifndef STK_POISSONBASE_H
35#define STK_POISSONBASE_H
37#include "../STK_IMixtureDensity.h"
40#include "../PoissonModels/STK_PoissonParameters.h"
47template<
class Derived>
81 template<
class Weights>
89 inline int rand(
int i,
int j,
int k)
const
106template<
class Derived>
110 for (
int j=p_data()->beginCols();
j<p_data()->endCols(); ++
j)
112 Real value = lambda(k,
j);
119template<
class Derived>
120template<
class Weights>
124 for (
int k= pk.begin(); k < pk.end(); ++k)
125 {
sum += pk[k] * lambda(k,
j);}
126 return std::floor(
sum+0.5);
130template<
class Derived>
134 for (
int k= p_tik->beginCols(); k < p_tik->endCols(); ++k)
135 {
sum += p_tik->elt(
i,k) * lambda(k,
j);}
142template<
class Derived>
146 params.resize(nbCluster(), p_data()->cols());
147 for (
int k=
params.beginRows(); k <
params.endRows(); ++k)
149 for (
int j= p_data()->beginCols();
j < p_data()->endCols(); ++
j)
159template<
class Derived>
163 for (
int k= p_tik->beginCols(); k < p_tik->endCols(); ++k)
165 for (
int j= p_data()->beginCols();
j < p_data()->endCols(); ++
j)
167 os <<
_T(
"---> Component ") << k <<
_T(
"\n");
In this file we define the Poisson distribution.
#define _T(x)
Let x unmodified.
Base class for all Mixture densities.
Array const *const & p_data() const
Parameters param_
parameters of the derived mixture model.
hidden::MixtureTraits< Derived >::Array Array
virtual Real lpdf(int const &x) const
compute the log probability distribution function.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Base class for the Poisson models.
Array const *const & p_data() const
Real impute(int i, int j, CArrayXX const *p_tik) const
void writeParameters(CArrayXX const *p_tik, ostream &os) const
This function can be used to write summary of parameters to the output stream.
void initializeModelImpl()
Initialize the parameters of the model.
Parameters param_
parameters of the derived mixture model.
void getParameters(Array ¶ms) const
This function is used in order to get the current values of the lambdas.
Real lambda(int k, int j) const
Real lnComponentProbability(int i, int k) const
IMixtureDensity< Derived > Base
int impute(int i, int j, Weights const &pk) const
PoissonBase(PoissonBase const &model)
copy constructor
PoissonBase(int nbCluster)
default constructor
int rand(int i, int j, int k) const
Arrays::SumOp< Lhs, Rhs >::result_type sum(Lhs const &lhs, Rhs const &rhs)
convenience function for summing two arrays
double Real
STK fundamental type of Real values.
std::basic_ostream< Char > ostream
ostream for Char
The namespace STK is the main domain space of the Statistical ToolKit project.