English Français

Documentation / Manuel développeur

Modules disponibles

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / XmlProblem: TBaseModel.h Source File
Uranie / XmlProblem  v4.10.0
/* @license-end */
TBaseModel.h
Go to the documentation of this file.
1 // 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 
44 #ifndef TBASEMODEL_H
45 #define TBASEMODEL_H
46 
47 #define DEFAULTTOLERANCE 0.0001
48 
49 // ROOT
50 #include "TNamed.h"
51 
52 // URANIE
53 #include "XMLProblem.h"
54 #include "UExceptions.h"
55 
56 namespace URANIE
57 {
58  namespace XMLProblem
59  {
60  class TBaseModel: public TNamed
61  {
62  public:
63  enum ELanguage
64  {
66  };
67  enum ENorm
68  {
70  };
71 
72  private:
73  TString _sinput;
74  TString _shidden;
75  TString _soutput;
76 
79 
82 
83  Int_t _niteration;
85 
86  Double_t _dlearn;
87  Double_t _dtolerance;
88  Int_t _nseed;
89  public:
90  TBaseModel();
91  TBaseModel(TString sinput, TString soutput);
92  TBaseModel(TString sname, TString sinput, TString shidden, TString soutput);
94  virtual ~TBaseModel();
95 
96  //---------------------------------------------
100  void setName(TString str)
101  {
102  SetName(str);
103  }
108  void setInput(TString str)
109  {
110  _sinput = str;
111  }
116  TString getInput()
117  {
118  return _sinput;
119  }
124  void setHidden(TString str)
125  {
126  _shidden = str;
127  }
132  TString getHidden()
133  {
134  return _shidden;
135  }
140  void setOutput(TString str)
141  {
142  _soutput = str;
143  }
148  TString getOutput()
149  {
150  return _soutput;
151  }
157  {
158  _nlanguage = val;
159  }
165  {
166  return _nlanguage;
167  }
173  {
174  _nNormType = n;
175  }
177 
182  {
183  return _nNormType;
184  }
189  void setFileNameExport(TString str)
190  {
191  _sfileNameExport = str;
192  }
198  {
199  return _sfileNameExport;
200  }
205  void setFunctionNameExport(TString str)
206  {
207  _sfunctionNameExport = str;
208  }
214  {
215  return _sfunctionNameExport;
216  }
221  void setNIteration(Int_t n)
222  {
223  try {
224  if (n < 0) {
225  throw URANIE::Exceptions::UErrorExceptions(__FILE__, __LINE__,
226  Form("TBaseModel::setNIteration Error\n The number of iteration must be positive [%d].", n));
227  }
228  } catch (URANIE::Exceptions::UErrorExceptions& ue)
229  {
230  ue.printMessage();
231  throw ue;
232  }
233  _niteration = n;
234  }
240  {
241  return _niteration;
242  }
247  void setNInitialization(Int_t n)
248  {
249  try {
250  if (n < 0) {
251  throw URANIE::Exceptions::UErrorExceptions(__FILE__, __LINE__,
252  Form("TBaseModel::setNInitialization Error\n The number of initialization must be positive [%d].", n));
253  }
254  } catch (URANIE::Exceptions::UErrorExceptions& ue)
255  {
256  ue.printMessage();
257  throw ue;
258  }
259  _ninitialization = n;
260  }
266  {
267  return _ninitialization;
268  }
273  void setLearn(Double_t dval)
274  {
275  try {
276  if ( ( dval < 0 ) || ( dval > 1.0 ) ) {
277  throw URANIE::Exceptions::UErrorExceptions(__FILE__, __LINE__,
278  Form("TBaseModel::setLearn Error\n The proportion must be in [0.0, 1.0], and we set to [%f].", dval));
279  }
280  } catch (URANIE::Exceptions::UErrorExceptions& ue)
281  {
282  ue.printMessage();
283  throw ue;
284  }
285  _dlearn = dval;
286  }
291  Double_t getLearn()
292  {
293  return _dlearn;
294  }
299  void setTolerance(Double_t dval)
300  {
301  try {
302  if ( dval < 0 ) {
303  throw URANIE::Exceptions::UErrorExceptions(__FILE__, __LINE__,
304  Form("TBaseModel::setTolerance Error\n The tolerance must be possitive [%f].", dval));
305  }
306  } catch (URANIE::Exceptions::UErrorExceptions& ue)
307  {
308  ue.printMessage();
309  throw ue;
310  }
311  _dtolerance = dval;
312  }
317  Double_t getTolerance()
318  {
319  return _dtolerance;
320  }
321 
326  void setSeed(Int_t n)
327  {
328  try {
329  if ( n < 0 ) {
330  throw URANIE::Exceptions::UErrorExceptions(__FILE__, __LINE__,
331  Form("TBaseModel::setSeed Error\n The seed must be possitive [%d].", n));
332  }
333  } catch (URANIE::Exceptions::UErrorExceptions& ue)
334  {
335  ue.printMessage();
336  throw ue;
337  }
338  _nseed = n;
339  }
340  Int_t getSeed()
341  {
342  return _nseed;
343  }
345 
346  //---------------------------------------------
350  void initExport();
352 
353  //---------------------------------------------
357  void printLog(Option_t *option = "");
359 
360  ClassDef(URANIE::XMLProblem::TBaseModel, ID_XMLPROBLEM)
361  //Classe de
362  };
363 
364  } // Fin du namespace XMLProblem
365 } // Fin du namespace URANIE
366 #endif
Definition: TBaseModel.h:56
void setNIteration(Int_t n)
set the number of iteration (split of the TDs in learning and test data base). 1 is default...
Definition: TBaseModel.h:221
TString _sfunctionNameExport
Definition: TBaseModel.h:81
Definition: TBaseModel.h:65
void setLearn(Double_t dval)
set the proportion of patterns to split the learning dataset in Learning and test databases...
Definition: TBaseModel.h:273
ENorm _nNormType
Definition: TBaseModel.h:78
TString getHidden()
getHidden
Definition: TBaseModel.h:132
Double_t getTolerance()
Get the tolerance parameter.
Definition: TBaseModel.h:317
ELanguage _nlanguage
Definition: TBaseModel.h:77
void printLog(Option_t *option="")
ELanguage
Definition: TBaseModel.h:63
Definition: TBaseModel.h:65
ENorm
Definition: TBaseModel.h:67
TString _shidden
Definition: TBaseModel.h:74
Int_t getSeed()
Definition: TBaseModel.h:340
TString _soutput
Definition: TBaseModel.h:75
Int_t _ninitialization
Definition: TBaseModel.h:84
TString _sfileNameExport
! The normalized for input and output
Definition: TBaseModel.h:80
void setTolerance(Double_t dval)
Set the tolerance parameter. It defined the stoppig rule for the optimization algorithm. It must be possitive and 1.e-4 is default value.
Definition: TBaseModel.h:299
void setSeed(Int_t n)
set the Seed parameter. It must be positive and 0 is default value.
Definition: TBaseModel.h:326
void setHidden(TString str)
setHidden
Definition: TBaseModel.h:124
Definition: TBaseModel.h:69
Definition: TBaseModel.h:69
Int_t _nseed
Definition: TBaseModel.h:88
void setInput(TString str)
set the "Input" of the model
Definition: TBaseModel.h:108
void setNormalization(ENorm n)
set the normalisation procedure between [kNO | kCR | kMinusOneOne| kZeroOne]. kCR is the default...
Definition: TBaseModel.h:172
Definition: TBaseModel.h:69
void setFunctionNameExport(TString str)
set the name of the function in the code source file
Definition: TBaseModel.h:205
void setLanguage(ELanguage val)
Set the language of the exported code source files.
Definition: TBaseModel.h:156
void setNInitialization(Int_t n)
set the number of initialisation step (weights for Neural Network learning). 1 is default value...
Definition: TBaseModel.h:247
TString getFunctionNameExport()
get the function name in the code source file
Definition: TBaseModel.h:213
TString getInput()
get the "Input" of the model
Definition: TBaseModel.h:116
Int_t getNInitialization()
get the number of initialisation step (weights for Neural Network learning)
Definition: TBaseModel.h:265
Definition: TBaseModel.h:65
Definition: TBaseModel.h:65
void setFileNameExport(TString str)
set the file name of the code source file
Definition: TBaseModel.h:189
virtual ~TBaseModel()
Default destructor.
Double_t _dlearn
Definition: TBaseModel.h:86
TString getOutput()
getOutput
Definition: TBaseModel.h:148
Description of the class TBaseModel.
Definition: TBaseModel.h:60
void setOutput(TString str)
set the "Output" of the model
Definition: TBaseModel.h:140
Definition: TBaseModel.h:65
ENorm getNormalization()
Get the normalisation parameter.
Definition: TBaseModel.h:181
Int_t _niteration
Definition: TBaseModel.h:83
Int_t getNIteration()
get the number of iteration (split of the TDs in learning and test data base)
Definition: TBaseModel.h:239
TString getFileNameExport()
get the file name of the code source file
Definition: TBaseModel.h:197
Double_t getLearn()
get the proportion of patterns to split the learning dataset in Learning and test databases...
Definition: TBaseModel.h:291
void setName(TString str)
Definition: TBaseModel.h:100
Double_t _dtolerance
Definition: TBaseModel.h:87
TString _sinput
Definition: TBaseModel.h:73
Definition: TBaseModel.h:65
ELanguage getLanguage()
get the language of the exported code source files
Definition: TBaseModel.h:164