English Français

Documentation / Developer's manual

Available modules

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / Modeler: TPolynomialRegression.h Source File
Uranie / Modeler v4.9.0
/* @license-end */
TPolynomialRegression.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
48#ifndef TPOLYNOMIALREGRESSION_H
49#define TPOLYNOMIALREGRESSION_H
50
51#define MAXLENGTHSTRING 250
52
53//ROOT
54
55// Uranie
56#include "TModeler.h"
57#include "TDataServer.h"
58#include "UMessageLogger.h"
59#include "TLinearRegression.h"
60
61namespace URANIE
62{
63namespace Modeler
64{
66{
67public:
72protected:
73 // the mutable declaration is needed to use the logger in const methods
74 URANIE::DataServer::UMessageLogger *_fLogger;
75
76private:
78 Double_t _dCriteria;
79
81 Bool_t _OKcomplete;
83 URANIE::DataServer::TDataServer *_completeDS;
85 TList *_lPropMonoms;
86 TString _sLROption;
88
89public:
90 Double_t _dr2a;
91 Double_t _dq2;
92 Double_t _dPress;
93
94 TTree* _ntresult;
97 Int_t _bRetained;
98 Double_t _dValueCriteria;
99 Double_t _dAllCriteria[3];
100
104 Int_t _nNumber;
105
106 Bool_t _bTrace;
107 TString _sTraceFile;
108 // Operations
109private:
111public:
112 //---------------------------------------------
116
130 TPolynomialRegression(URANIE::DataServer::TDataServer *tds,
131 TString architecture, Option_t *option = "");
133
147 TPolynomialRegression(URANIE::DataServer::TDataServer *tds,
148 const char *varexpinput, const char *varexpoutput,
149 Option_t * option = "");
153
154 //---------------------------------------------
158
159 Double_t getR2Adjusted()
160 {
161 return _dr2a;
162 }
164 Double_t getQ2()
165 {
166 return _dq2;
167 }
169 Double_t getPress()
170 {
171 return _dPress;
172 }
174
178 void setMinimalOrder(Int_t iorder)
179 {
180 if (iorder < 0)
181 throw URANIE::Exceptions::UErrorExceptions(__FILE__, __LINE__,
182 "TPolynomialRegression::setMinimalOrder - Error: invalid value for minimal order (Need to be >0)");
183 else if (iorder > _nMaxOrder)
184 throw URANIE::Exceptions::UErrorExceptions(__FILE__, __LINE__,
185 "TPolynomialRegression::setMinimalOrder - Error: invalid value for minimal order (Need to be lower than maximal order)");
186 _nMinOrder = iorder;
187 }
188
190
194 void setMaximalOrder(Int_t iorder)
195 {
196 if (iorder < 0)
197 throw URANIE::Exceptions::UErrorExceptions(__FILE__, __LINE__,
198 "TPolynomialRegression::setMaximalOrder - Error: invalid value for maximal order (Need to be >0)");
199 else if (iorder < _nMinOrder)
200 throw URANIE::Exceptions::UErrorExceptions(__FILE__, __LINE__,
201 "TPolynomialRegression::setMaximalOrder - Error: invalid value for maximal order (Need to be greater than minimal order)");
202 else if (iorder > 2)
203 throw URANIE::Exceptions::UErrorExceptions(__FILE__, __LINE__,
204 "TPolynomialRegression::setMaximalOrder - Error: a maximal order greater than 2 is under development");
205 _nMaxOrder = iorder;
206 _bChangemaxorder = true;
207 }
209
212 void setMaxMonomes(Int_t n);
215 {
216 return _nMaxMonomes;
217 }
218
220
225 void setTrace(TString straceFile = "");
228 {
229 _bTrace = kFALSE;
230 }
232 Bool_t getTrace()
233 {
234 return _bTrace;
235 }
237 TString getTraceFile();
238
240
244 void setCriteria(Double_t dcriteria)
245 {
246 if (dcriteria < 0.)
247 throw URANIE::Exceptions::UErrorExceptions(__FILE__, __LINE__,
248 "TPolynomialRegression::setCriteria - Error: invalid value for criteria (Need to be >0)");
249 else if (dcriteria > 1.)
250 throw URANIE::Exceptions::UErrorExceptions(__FILE__, __LINE__,
251 "TPolynomialRegression::setCriteria - Error: invalid value for criteria (Need to lower than 1)");
252 _dCriteria = dcriteria;
253 }
255
295 {
296 return _ntresult;
297 }
299 //---------------------------------------------
303 void estimate(Option_t * option = "");
304
306
308 void estimateExaustiveResearch(Option_t * option);
309 void recursiveSearch(TList * tl, Int_t npos, TString str);
310
312
317 void fillIndex(TString sinputname, Double_t dval, Int_t bRetained = 0);
319
320 //---------------------------------------------
324
331// void exportFunction(const char* lang, const char* file = "",
332// const char* name = "");
334
338 void exportModelCplusplus(std::ofstream * sourcefile) const;
340
344 void exportModelFortran(std::ofstream * sourcefile) const;
345
347
351 void exportModelPMML(const char* file = "",
352 const char* name = "",Option_t *option = "") const
353 {
354 TString soption = option;
355 soption.ToLower();
356 UNUSED(file,name);
357 std::cerr
358 << " --- Method TPolynomialRegression::exportModelPMML(ofstream * sourcefile) not yet implemented"
359 << endl;
360 };
361
363
367 void exportModelPython(std::ofstream * sourcefile) const
368 {
369 UNUSED(sourcefile);
370 std::cerr
371 << " --- Method TPolynomialRegression::exportModelPython(ofstream * sourcefile) not yet implemented"
372 << endl;
373 };
374
376
377 //---------------------------------------------
381 virtual void printLog(Option_t *option = "");
383
384 ClassDef(URANIE::Modeler::TPolynomialRegression, ID_MODELER)
385 //Classe de
386};
387
388} // Fin du namespace Modeler
389} // Fin du namespace URANIE
390#endif
Interface de la classe URANIE::Modeler::TLinearRegression.
Interface of the class URANIE::Optimize::TModeler.
#define MAXLENGTHSTRING
Definition TPolynomialRegression.h:51
Description of the class TLinearRegression.
Definition TLinearRegression.h:52
Definition TModeler.h:63
Description of the class TPolynomialRegression.
Definition TPolynomialRegression.h:66
void unsetTrace()
Unset trace.
Definition TPolynomialRegression.h:227
void setCriteria(Double_t dcriteria)
Set the wanted criteria.
Definition TPolynomialRegression.h:244
TString getTraceFile()
Return the name of the trace file.
TObjArray * _drawingGarbageCollector
Garbage collector for drawn objects.
Definition TPolynomialRegression.h:87
TPolynomialRegression(URANIE::DataServer::TDataServer *tds, TString architecture, Option_t *option="")
Default constructor with the TDataServer and architecture.
void exportModelFortran(std::ofstream *sourcefile) const
Export the model in Fortran langage in a file.
Double_t _dr2a
The Adjusted R2 quality.
Definition TPolynomialRegression.h:90
Double_t _dAllCriteria[3]
The current value of the criteria ( fill the TTree)
Definition TPolynomialRegression.h:99
Int_t _nMaxOrder
The maximal order of the polynomial.
Definition TPolynomialRegression.h:102
Double_t _dPress
The Press quality.
Definition TPolynomialRegression.h:92
ECriteria _nCriteria
Message logger.
Definition TPolynomialRegression.h:77
Int_t _nMonomials
The list of retained monomials.
Definition TPolynomialRegression.h:96
void setMaxMonomes(Int_t n)
Set the maximal number of monomia to add (exaustive research)
void exportModelPMML(const char *file="", const char *name="", Option_t *option="") const
Export the model in a PMML file (not yet implemented)
Definition TPolynomialRegression.h:351
URANIE::Modeler::TLinearRegression * _theTLR
True if _complete data server can be use.
Definition TPolynomialRegression.h:82
Int_t getMaxMonomes()
Return the maximal number of monomia.
Definition TPolynomialRegression.h:214
TTree * _ntresult
The TTree of results.
Definition TPolynomialRegression.h:94
Int_t _bRetained
The number of retained monomials.
Definition TPolynomialRegression.h:97
Double_t _dCriteria
The value of wanted criteria.
Definition TPolynomialRegression.h:78
virtual ~TPolynomialRegression()
Default destructor.
void setMinimalOrder(Int_t iorder)
Set the minimal order of the polynomial.
Definition TPolynomialRegression.h:178
virtual void printLog(Option_t *option="")
Bool_t getTrace()
Return the trace flag.
Definition TPolynomialRegression.h:232
TString _sTraceFile
The name of the trace file.
Definition TPolynomialRegression.h:107
URANIE::DataServer::TDataServer * _completeDS
The complete data server for the maximalorder wanted.
Definition TPolynomialRegression.h:83
Int_t _nNumber
the current number of polynome
Definition TPolynomialRegression.h:104
void recursiveSearch(TList *tl, Int_t npos, TString str)
Bool_t _bTrace
The flag to known is trace is needed.
Definition TPolynomialRegression.h:106
Int_t _nMaxMonomes
The maximal number of monomia to insert (exaustive research)
Definition TPolynomialRegression.h:103
Double_t getR2Adjusted()
Return the Adjusted R2 statistic.
Definition TPolynomialRegression.h:159
Double_t _dValueCriteria
The number to known if the momonials are added.
Definition TPolynomialRegression.h:98
Double_t _dq2
The Q2 quality.
Definition TPolynomialRegression.h:91
Char_t _sMonomials[MAXLENGTHSTRING]
Definition TPolynomialRegression.h:95
Bool_t _OKcomplete
True if value of maximal order of the polynomial has changed.
Definition TPolynomialRegression.h:81
Bool_t _bChangemaxorder
Definition TPolynomialRegression.h:80
TString _sCompleteInputAttributes
The string of complete input attributes (separated by the character ":".
Definition TPolynomialRegression.h:84
Int_t _nMinOrder
The vector of 3 criteria (R2, R2A, Q2) ( fill the TTree)
Definition TPolynomialRegression.h:101
Double_t getPress()
Return the PRESS statistic.
Definition TPolynomialRegression.h:169
TPolynomialRegression(URANIE::DataServer::TDataServer *tds, const char *varexpinput, const char *varexpoutput, Option_t *option="")
Default constructor with the TDataServer and input and output attributes.
void exportModelPython(std::ofstream *sourcefile) const
Export the model in Python langage in a file (not yet implemented)
Definition TPolynomialRegression.h:367
TTree * getResultsTree()
Get the TTree of results.
Definition TPolynomialRegression.h:294
void exportModelCplusplus(std::ofstream *sourcefile) const
Export the model in an external file with a specified langage.
void fillIndex(TString sinputname, Double_t dval, Int_t bRetained=0)
Method to fill in the tree the value of temporal results.
Double_t getQ2()
Return the Q2 statistic.
Definition TPolynomialRegression.h:164
TString _sLROption
The list of monoms containing potential candidates.
Definition TPolynomialRegression.h:86
void estimateExaustiveResearch(Option_t *option)
Exhaustive research when the number of maximal monomes is no-negative.
void setTrace(TString straceFile="")
Activate the trace of the process.
ECriteria
Definition TPolynomialRegression.h:69
@ kR2A
Definition TPolynomialRegression.h:70
@ kUnknown
Definition TPolynomialRegression.h:70
@ kR2
Definition TPolynomialRegression.h:70
@ kQ2
Definition TPolynomialRegression.h:70
void setMaximalOrder(Int_t iorder)
Set the maximal order of the polynomial.
Definition TPolynomialRegression.h:194
TList * _lPropMonoms
Definition TPolynomialRegression.h:85
URANIE::DataServer::UMessageLogger * _fLogger
Definition TPolynomialRegression.h:74
void estimate(Option_t *option="")
ROOT.
Definition TAnisp.h:164