English Français

Documentation / Developer's manual

Available modules

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / Modeler: TGLM.h Source File
Uranie / Modeler v4.9.0
/* @license-end */
TGLM.h
Go to the documentation of this file.
1
2// Copyright (C) 2013-2024 CEA/DES
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 published
6// by the Free Software Foundation, either version 3 of the License, or any
7// 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 License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
18// $Id$
19// $Author$
20// $Date$
21// $Revision$
22// $State$
24
32/*
33 class="" URANIE::Modeler::TGLM
34
35 @brief Description of the class TGLM.
36
37 This class implements the \b "Generalized \b Linear \b Models" model
38
39 The algorith implemented is the \b Iterative \b Weighted \b Least \b Squares (\b IWLS ).
40 \li Assign starting values to the parameters \f$ beta^{(0)}\f$, generally by resolving the Least Squares Normal equations (i.e. without weights);
41 \li Update the \f$ \eta^{(i)}\f$ and \f$ \mu^{(i)}\f$ with parameters \f$ beta^{(i)}\f$
42 \li Update the weights using the new estimated mean vector: \f$ \frac{1}{v^(i+1)} = \var(\mu^{i}) * f(\mu^{i}) \f$
43 \li Resolve the Weighted Least Squares Normal equations to give \f$ beta^{(i+1)}\f$
44 \li Repeat the thre last steps until convergence (\em i.e. \f$ X\hat{\Beta^{i}} - X\hat{\Beta^{i+1}}\f$ is sufficiently close to zero).
45 */
46#ifndef TGLM_H
47#define TGLM_H
48
49//ROOT
50
51// Uranie
52#include "TModeler.h"
53
54namespace URANIE
55{
56namespace Modeler
57{
58class TGLM: public TModeler
59{
60 // Attributs
61public:
70private:
75
76 TVectorD _vecBetaInit;
77 Double_t _dTolerance;
78 Double_t _dNullDeviance;
80 // Operations
81public:
82 //---------------------------------------------
86
87 /*
88 \param tds (URANIE::DataServer::TDataServer *) the dataserver
89 \param architecture(TString) The architecture (input and output attributes) of the model separated by the caracter ":"
90 \param option (Option_t *)[""] The option to pass
91 */
92 TGLM(URANIE::DataServer::TDataServer *tds, TString architecture,
93 Option_t *option = "");
95 /*
96 \param tds (URANIE::DataServer::TDataServer *) the dataserver
97 \param varexpinput(const char*)[""] The list of input attributes to pass to the function separated by the caracter ":"
98 \param varexpoutput (const char *)[""] The list of output attributes separated by the caracter ":"
99 \param option (Option_t *)[""] The option to pass
100 */
101 TGLM(URANIE::DataServer::TDataServer *tds, const char *varexpinput,
102 const char *varexpoutput, Option_t * option = "");
104 virtual ~TGLM();
106
107 //---------------------------------------------
111
116 void setFamily(EDistribution nYDistribution = kUnknown,
117 ELinkFunctin nLinkFunction = kCanonical);
125 {
126 return _nLinkFunction;
127 }
129 void setMaxIteration(Int_t n)
130 {
131 if (n > -1)
132 _nMaxIteration = n;
133 }
136 {
137 return _nIteration;
138 }
141 {
142 return _nMaxIteration;
143 }
145 void setTolerance(Double_t dtol)
146 {
147 if (dtol > 0)
148 _dTolerance = dtol;
149 }
151 Double_t getTolerance()
152 {
153 return _dTolerance;
154 }
157 {
158 return _dNullDeviance;
159 }
162 {
163 return _dResidualDeviance;
164 }
166 void setInitialBeta(TVectorD vecIni);
168 TVectorD getInitialBeta()
169 {
170 return _vecBetaInit;
171 }
173
174 //---------------------------------------------
178 void estimate(Option_t * option = "");
180
183 void fillData(TMatrixD &Aw, TVectorD &yw, TMatrixD &matY);
185
186 //---------------------------------------------
190
195 void exportModelCplusplus(std::ofstream * sourcefile) const;
197
201 void exportModelFortran(std::ofstream * sourcefile) const;
202
203
205
209 void exportModelPMML(const char* file = "",
210 const char* name = "",Option_t *option = "") const
211 {
212 TString soption = option;
213 soption.ToLower();
214 UNUSED(file,name);
215 std::cerr
216 << " --- Method TGLM::exportModelPMML(ofstream * sourcefile) not yet implemented"
217 << endl;
218 throw URANIE::Exceptions::UWarningExceptions(__FILE__, __LINE__,
219 "TGLM::exportFunction\n The PMML language is not yet implemented.");
220 };
221
223
227 void exportModelPython(std::ofstream * sourcefile) const
228 {
229 UNUSED(sourcefile);
230 std::cerr
231 << " --- Method TGLM::exportModelPython(ofstream * sourcefile) not yet implemented"
232 << endl;
233 throw URANIE::Exceptions::UWarningExceptions(__FILE__, __LINE__,
234 "TGLM::exportFunction\n The Python language is not yet implemented.");
235 };
237
238 //---------------------------------------------
242 void printLog(Option_t *option = "");
244
245 ClassDef(URANIE::Modeler::TGLM, ID_MODELER)
246 //Classe de
247};
248} // Fin du namespace Modeler
249} // Fin du namespace URANIE
250#endif // TGLM_H
Interface of the class URANIE::Optimize::TModeler.
Definition TGLM.h:59
void setFamily(EDistribution nYDistribution=kUnknown, ELinkFunctin nLinkFunction=kCanonical)
Set the family of error (Distribution of and Link Function)
TVectorD _vecBetaInit
Inital Vector for beta.
Definition TGLM.h:76
TVectorD getInitialBeta()
Get the initial parameter.
Definition TGLM.h:168
void exportModelPMML(const char *file="", const char *name="", Option_t *option="") const
Export the model in a PMML file (not yet implemented)
Definition TGLM.h:209
Double_t _dTolerance
The tolerance to stop algorithm (default 1.e-6)
Definition TGLM.h:77
Int_t _nIteration
the number of iteration at convergence (default 0)
Definition TGLM.h:73
void printLog(Option_t *option="")
TGLM(URANIE::DataServer::TDataServer *tds, const char *varexpinput, const char *varexpoutput, Option_t *option="")
Default constructor with input and output attributes.
Int_t _nMaxIteration
the number of maximum iteration (default 25)
Definition TGLM.h:74
ELinkFunctin getLinkFunction()
Return the link function.
Definition TGLM.h:124
EDistribution getYDistribution()
Return the type of Y distribution.
Definition TGLM.h:119
EDistribution
Definition TGLM.h:63
@ kGamma
Definition TGLM.h:64
@ kUnknown
Definition TGLM.h:64
@ kBinomial
Definition TGLM.h:64
@ kPoisson
Definition TGLM.h:64
@ kNormal
Definition TGLM.h:64
void exportModelPython(std::ofstream *sourcefile) const
Export the model in Python langage in a file (not yet implemented)
Definition TGLM.h:227
ELinkFunctin _nLinkFunction
The link function (default kCanonical)
Definition TGLM.h:72
Double_t getNullDeviance()
Get the Null Deviance value.
Definition TGLM.h:156
TGLM(URANIE::DataServer::TDataServer *tds, TString architecture, Option_t *option="")
Default constructor with the TDataServer and the architecture.
void exportModelCplusplus(std::ofstream *sourcefile) const
Export the model in C++ langage in a file.
void estimate(Option_t *option="")
Int_t getMaxIteration()
Get the number of maximum iteration.
Definition TGLM.h:140
void setMaxIteration(Int_t n)
Set the number of maximum iteration.
Definition TGLM.h:129
Double_t getTolerance()
Get the Tolerance.
Definition TGLM.h:151
EDistribution _nDistribution
The type of Y distribution.
Definition TGLM.h:71
void exportModelFortran(std::ofstream *sourcefile) const
Export the model in Fortran langage in a file.
void setTolerance(Double_t dtol)
Set the Tolerance.
Definition TGLM.h:145
void setInitialBeta(TVectorD vecIni)
Set the initial parameter.
Double_t _dResidualDeviance
The Residual Deviance value.
Definition TGLM.h:79
void fillData(TMatrixD &Aw, TVectorD &yw, TMatrixD &matY)
Fill the data in a TMatrix and a TVector.
virtual ~TGLM()
Default destructor.
Double_t _dNullDeviance
The Null Deviance value.
Definition TGLM.h:78
Double_t getResidualDeviance()
Get the Residual Deviance value.
Definition TGLM.h:161
ELinkFunctin
Definition TGLM.h:67
@ kLogLog
Definition TGLM.h:68
@ kIdentity
Definition TGLM.h:68
@ kCanonical
Definition TGLM.h:68
@ kInverse
Definition TGLM.h:68
@ kProbit
Definition TGLM.h:68
@ kLog
Definition TGLM.h:68
@ kLogit
Definition TGLM.h:68
Int_t getNIteration()
Get the number iterations at convergence.
Definition TGLM.h:135
Definition TModeler.h:63
ROOT.
Definition TAnisp.h:164