STK++ 0.9.13
STK_PoissonParameters.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------*/
2/* Copyright (C) 2004-2016 Serge Iovleff
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this program; if not, write to the
16 Free Software Foundation, Inc.,
17 59 Temple Place,
18 Suite 330,
19 Boston, MA 02111-1307
20 USA
21
22 Contact : S..._DOT_I..._AT_stkpp.org (see copyright for ...)
23*/
24
25/*
26 * Project: stkpp::Clustering
27 * created on: Oct 24, 2013
28 * Author: Serge Iovleff
29 **/
30
36#ifndef STK_POISSONPARAMETERS_H
37#define STK_POISSONPARAMETERS_H
38
39#include "../STK_Clust_Util.h"
40
44
47
48namespace STK
49{
53template<>
54struct ModelParameters<Clust::Poisson_ljlk_>
55{
64
68 ModelParameters(int nbCluster);
72 ModelParameters( ModelParameters const& param);
75
77 inline Real lambda(int k, int j) const { return lambdak_[k] * lambdaj_[j];}
78
80 void resize(Range const& range);
81
83 void updateStatistics();
85 void setStatistics();
87 void releaseStatistics();
88
92 template<class Array>
94 {
95 lambdak_ = Stat::meanByRow(params.asDerived());
96 lambdaj_ = Stat::meanByCol(params.asDerived());
97 Real cte = std::sqrt((params/(lambdak_ * lambdaj_)).mean());
98 lambdak_ *= cte;
99 lambdaj_ *= cte;
100 }
101};
102
106template<>
107struct ModelParameters<Clust::Poisson_ljk_>
108{
113
117 ModelParameters(int nbCluster);
121 ModelParameters( ModelParameters const& param);
124
126 inline Real const& lambda(int k, int j) const { return lambda_[k][j];}
127
129 void resize(Range const& range);
130
132 void updateStatistics();
134 void setStatistics();
136 void releaseStatistics();
137
141 template<class Array>
143 {
144 for(int k=lambda_.begin(); k<lambda_.end(); ++k)
145 { lambda_[k] = params.row(k);}
146 }
147};
148
152template<>
153struct ModelParameters<Clust::Poisson_lk_>
154{
159
163 ModelParameters(int nbCluster);
167 ModelParameters( ModelParameters const& param);
170
172 inline Real const& lambda(int k, int j) const { return lambda_[k];}
173
175 void resize(Range const& range);
176
178 void updateStatistics();
180 void setStatistics();
182 void releaseStatistics();
183
187 template<class Array>
189 {
190 for(int k=lambda_.begin(); k<lambda_.end(); ++k)
191 { lambda_[k] = params.row(k).mean();}
192 }
193};
194
195
196} // namespace STK
197
198#endif /* STK_POISSONPARAMETERS_H */
In this file we define and implement the final class Array1D.
In this file we implement the final class CArrayPoint.
In this file we implement the final class CArrayVector.
This file contain the functors computings statistics.
This file contain the definition and implementation of the Online classes.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Index sub-vector region: Specialization when the size is unknown.
Definition STK_Range.h:265
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...
hidden::FunctorTraits< Derived, MeanOp >::Row meanByCol(Derived const &A)
hidden::FunctorTraits< Derived, MeanOp >::Col meanByRow(Derived const &A)
The namespace STK is the main domain space of the Statistical ToolKit project.
Array1D< Stat::Online< CPointX, Real > > stat_lambda_
Array of the lambdak_ statistics.
Array1D< CPointX > lambda_
intensity of the variables
void setParameters(ExprBase< Array > const &params)
Set the parameters of the mixture model.
CVectorX lambdak_
intensity of the variables by class
void setParameters(ExprBase< Array > const &params)
Set the parameters of the mixture model.
Array1D< Stat::Online< Real, Real > > stat_lambdak_
Array of the lambdak_ statistics.
CPointX lambdaj_
intensity of the variables by variables
Stat::Online< CVectorX, Real > stat_lambdaj_
Array of the lambdaj_ statistics.
Array1D< Stat::Online< Real, Real > > stat_lambda_
Array of the lambdak_ statistics.
void setParameters(ExprBase< Array > const &params)
Set the parameters of the mixture model.
Array1D< Real > lambda_
intensity of the variables
struct storing the parameters of the mixture.