35#ifndef STK_HDGAUSSIANBASE_H
36#define STK_HDGAUSSIANBASE_H
38#include "../STK_IMixtureDensity.h"
54template<
class Derived>
79 inline int const&
d(
int k)
const {
return param_.d(k);}
93 template<
class Weights>
104 template<
class Array>
121template<
class Derived>
122template<
class Weights>
126 for (
int k= pk.begin(); k < pk.end(); ++k)
131template<
class Derived>
136 for(
int i=p_data()->beginRows();
i< p_data()->endRows(); ++
i) {
indexes[
i] =
i;}
139 for (
int k= p_tik->beginCols(); k < p_tik->endCols(); ++k)
144 param_.mean_[k] = p_data()->row(
indexes[
i]);
152template<
class Derived>
155 for (
int k= p_tik->beginCols(); k < p_tik->endCols(); ++k)
157 for (
int j=p_data()->beginCols();
j< p_data()->endCols(); ++
j)
158 { param_.mean_[k][
j] = p_data()->col(
j).wmean(p_tik->
col(k));}
167template<
class Derived>
173 for (
int k= 0; k <
nbClust; ++k)
188template<
class Derived>
191 CPointX m(p_data()->cols()), s(p_data()->cols());
192 for (
int k= p_tik->beginCols(); k < p_tik->endCols(); ++k)
195 for (
int j= s.begin();
j < s.end(); ++
j)
197 os <<
_T(
"---> Component ") << k <<
_T(
"\n");
198 os <<
_T(
"mean = ") <<
m;
199 os <<
_T(
"sigma = ")<< s;
In this file we implement the final class CArrayPoint.
In this file we implement the final class CArrayVector.
In this file we implement the final class CArray.
In this file we define the constant Arrays.
This file define methods for displaying Arrays and Expressions.
In this file we define the Normal probability law class.
This file contain the functors computings statistics.
#define _T(x)
Let x unmodified.
Base class for the diagonal Gaussian models.
Real const & b(int k) const
~HDGaussianBase()
destructor
Real rand(int i, int j, int k) const
IMixtureDensity< Derived > Base
Array const *const & p_data() const
void writeParameters(CArrayXX const *p_tik, ostream &os) const
This function can be used to write summary of parameters to the output stream.
Parameters param_
parameters of the derived mixture model.
HDGaussianBase(int nbCluster)
default constructor
bool updateMean(CArrayXX const *p_tik)
compute the weighted mean of a Gaussian mixture.
void getParameters(Array ¶ms) const
This function is used in order to get the current values of the means and standard deviations.
Real const & q(int k) const
HDGaussianBase(HDGaussianBase const &model)
copy constructor
Real const & a(int j, int k) const
void randomMean(CArrayXX const *p_tik)
sample randomly the mean of each component by sampling randomly a row of the data set.
Real const & mean(int k, int j) const
void initializeModelImpl()
Initialize the parameters of the model.
int const & d(int k) const
Real impute(int i, int j, Weights const &pk) const
hidden::CSlice< Derived, sizeRows_, 1 >::Result col(int j) const
implement the col operator using a reference on the column of the allocator
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
Real rand() const
Generate a pseudo Normal random variate.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Index sub-vector region: Specialization when the size is unknown.
Arrays::SumOp< Lhs, Rhs >::result_type sum(Lhs const &lhs, Rhs const &rhs)
convenience function for summing two arrays
const int baseIdx
base index of the containers created in STK++.
double Real
STK fundamental type of Real values.
hidden::SliceVisitorSelector< Derived, hidden::MeanVisitor, Arrays::by_col_ >::type_result mean(Derived const &A)
If A is a row-vector or a column-vector then the function will return the usual mean value of the vec...
std::basic_ostream< Char > ostream
ostream for Char
The namespace STK is the main domain space of the Statistical ToolKit project.