English Français

Documentation / Developer's manual

Available modules

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / Modeler: URANIE::Modeler::TkNN Class Reference
Uranie / Modeler v4.9.0
/* @license-end */
URANIE::Modeler::TkNN Class Reference

k Nearsest Neighbor algorithm More...

#include <TkNN.h>

Inheritance diagram for URANIE::Modeler::TkNN:
Collaboration diagram for URANIE::Modeler::TkNN:

Public Member Functions

Constructor and Destructor
 TkNN (URANIE::DataServer::TDataServer *tds, TString architecture, Option_t *option="")
 Default constructor with the TDataServer.
 
 TkNN (URANIE::DataServer::TDataServer *tds, const char *varexpinput, const char *varexpoutput, Int_t nkernel, Option_t *option="")
 Default constructor with input and output attributes.
 
virtual ~TkNN ()
 Default destructor.
 
Setter and Getter function
void setK (Int_t k)
 Set the number of neighbor (\it k)
 
Int_t getK ()
 Get the number of neighbor (\it k)
 
void setQueryPoints (URANIE::DataServer::TDataServer *tds)
 Set the set of query points from a dataserver.
 
Estimate
void draw (const char *vars, Option_t *option="")
 draw
 
void estimate (Option_t *option="", Bool_t useGPU=false)
 make the learning
 
Export the model in extrenal langage
void exportModelCplusplus (std::ofstream *sourcefile) const
 Export the model in C++ langage in a file.
 
void exportModelFortran (std::ofstream *sourcefile) const
 Export the model in Fortran langage in a file.
 
void exportModelPMML (const char *file="", const char *name="", Option_t *option="") const
 Export the model as a PMML function (not implemented)
 
void exportModelPython (std::ofstream *sourcefile) const
 Export the model as a Python function (not implemented)
 
- Public Member Functions inherited from URANIE::Modeler::TModeler
 TModeler (URANIE::DataServer::TDataServer *tds, TString architecture, Option_t *option="")
 Constructor with a dataserver.
 
 TModeler (URANIE::DataServer::TDataServer *tds, const char *varexpinput, const char *varexpoutput, Option_t *option="")
 Default constructor with input and output attributes.
 
virtual ~TModeler ()
 Default destructor.
 
TVectorD getParameters ()
 Return the parameter vector of the model.
 
Double_t getR2 () const
 Return the R2 quality.
 
const char * getInputName (Int_t i) const
 Return the name of input attributes.
 
const char * getOutputName (Int_t i=0)
 Return the name of output attribute.
 
Int_t getNInput ()
 Gets the number of input.
 
Bool_t getIntercept ()
 Gets the boolean attribut _bIntercept.
 
void setDrawProgressBar (Bool_t bbool=kTRUE)
 Set the "draw progress bar" flag.
 
Bool_t getDrawProgressBar ()
 Get the "draw progress bar" flag.
 
void train (Option_t *option="text")
 
virtual void exportFunction (const char *lang, const char *file="", const char *name="", Option_t *option="")
 Export the model in an external file with a specified langage.
 
void setLog ()
 
void unsetLog ()
 
void changeLog ()
 
Bool_t getLog ()
 

Public Attributes

Double_t _dr2a
 The Adjusted R2 quality.
 
Int_t _nK
 the number of neighboor to take into account
 
EDistance _nDistance
 
TString _sDraw
 ! The distance normalized for input and output
 
URANIE::DataServer::TDataServer * _tdsQuery
 the TDS contins the query points
 
- Public Attributes inherited from URANIE::Modeler::TModeler
Bool_t _blog
 Boolean for edit the log.
 
Bool_t _bdrawProgressBar
 Boolean to know if the progress bar has to be drawn.
 
Bool_t _bStoreYHat
 Boolean to specify if we add the \hat{} attribute in the TDS [default kTRUE].
 
URANIE::DataServer::TDataServer * _tds
 
Int_t _nS
 Pointer to a TDS.
 
TString _sInputAttributes
 The string of input attributes (separated by the character ":".
 
TString _sOutputAttributes
 The string of output attributes (separated by the character ":".
 
TString _sIntermediateArchitecture
 The intermediate (between the first and last character ",") information.
 
TList * _listOfInputAttributes
 The list of input Leaf.
 
TList * _listOfOutputAttributes
 The list of output Leaf.
 
Int_t _nX
 The number of input attributes.
 
Int_t _nY
 The number of output attributes.
 
TString _sFileName
 The name of the file when export the model without extension.
 
TString _sFunctionName
 The name of the function when export the model.
 
TVectorD _parameterValues
 The list of parameters.
 
Double_t _dr2
 The R2 quality.
 
Bool_t _bIntercept
 For certain models, add the intercept (Default is TRUE)
 

Printing Log

virtual void printLog (Option_t *option="")
 
void estimate_cpu (Option_t *option="")
 
void LSort (int n, double *array, int *index, Int_t nbthreads)
 
void beginLoop (Int_t iq, Int_t nsq)
 
void endLoop (Int_t iq, int nsr, double *vecDistance, int *vecIndex, Float_t *vecReferenceOutput, Double_t *tabValue, TBranch *tby, Int_t nbthreads)
 

Detailed Description

k Nearsest Neighbor algorithm

The TDS in the constructor is the data set to the reference points.

Constructor & Destructor Documentation

◆ TkNN() [1/2]

URANIE::Modeler::TkNN::TkNN ( URANIE::DataServer::TDataServer *  tds,
TString  architecture,
Option_t *  option = "" 
)

Default constructor with the TDataServer.

Referenced by ClassImp().

◆ TkNN() [2/2]

URANIE::Modeler::TkNN::TkNN ( URANIE::DataServer::TDataServer *  tds,
const char *  varexpinput,
const char *  varexpoutput,
Int_t  nkernel,
Option_t *  option = "" 
)

Default constructor with input and output attributes.

◆ ~TkNN()

virtual URANIE::Modeler::TkNN::~TkNN ( )
virtual

Default destructor.

Referenced by ClassImp().

Member Function Documentation

◆ beginLoop()

void URANIE::Modeler::TkNN::beginLoop ( Int_t  iq,
Int_t  nsq 
)
private

Referenced by ClassImp().

◆ draw()

void URANIE::Modeler::TkNN::draw ( const char *  vars,
Option_t *  option = "" 
)

draw

Referenced by ClassImp().

◆ endLoop()

void URANIE::Modeler::TkNN::endLoop ( Int_t  iq,
int  nsr,
double *  vecDistance,
int *  vecIndex,
Float_t *  vecReferenceOutput,
Double_t *  tabValue,
TBranch *  tby,
Int_t  nbthreads 
)
private

Referenced by ClassImp().

◆ estimate()

void URANIE::Modeler::TkNN::estimate ( Option_t *  option = "",
Bool_t  useGPU = false 
)

make the learning

Referenced by ClassImp().

◆ estimate_cpu()

void URANIE::Modeler::TkNN::estimate_cpu ( Option_t *  option = "")
private

Referenced by ClassImp().

◆ exportModelCplusplus()

void URANIE::Modeler::TkNN::exportModelCplusplus ( std::ofstream *  sourcefile) const
virtual

Export the model in C++ langage in a file.

Warning
Don't use this method. Use the main method TModeler::exportFunction.
Parameters
sourcefile(ofstream *) the pointer to the file to export the modeler.

Implements URANIE::Modeler::TModeler.

Referenced by ClassImp().

◆ exportModelFortran()

void URANIE::Modeler::TkNN::exportModelFortran ( std::ofstream *  sourcefile) const
virtual

Export the model in Fortran langage in a file.

Warning
Don't use this method. Use the main method TModeler::exportFunction.
Parameters
sourcefile(ofstream *) the pointer to the file to export the modeler.

Implements URANIE::Modeler::TModeler.

Referenced by ClassImp().

◆ exportModelPMML()

void URANIE::Modeler::TkNN::exportModelPMML ( const char *  file = "",
const char *  name = "",
Option_t *  option = "" 
) const
inlinevirtual

Export the model as a PMML function (not implemented)

Implements URANIE::Modeler::TModeler.

◆ exportModelPython()

void URANIE::Modeler::TkNN::exportModelPython ( std::ofstream *  sourcefile) const
inlinevirtual

Export the model as a Python function (not implemented)

Implements URANIE::Modeler::TModeler.

◆ getK()

Int_t URANIE::Modeler::TkNN::getK ( )
inline

Get the number of neighbor (\it k)

References _nK.

◆ LSort()

void URANIE::Modeler::TkNN::LSort ( int  n,
double *  array,
int *  index,
Int_t  nbthreads 
)
private

Referenced by ClassImp().

◆ printLog()

virtual void URANIE::Modeler::TkNN::printLog ( Option_t *  option = "")
virtual

Reimplemented from URANIE::Modeler::TModeler.

Referenced by ClassImp().

◆ setK()

void URANIE::Modeler::TkNN::setK ( Int_t  k)
inline

Set the number of neighbor (\it k)

Parameters
k(Int_t) k is the number of neighbor into the reference points to select for a query point

References _nK.

◆ setQueryPoints()

void URANIE::Modeler::TkNN::setQueryPoints ( URANIE::DataServer::TDataServer *  tds)

Set the set of query points from a dataserver.

Parameters
tds(URANIE::DataServer::TDataServer) the TDS which contains the set of query points

Referenced by ClassImp().

Member Data Documentation

◆ _dr2a

Double_t URANIE::Modeler::TkNN::_dr2a

The Adjusted R2 quality.

◆ _nDistance

EDistance URANIE::Modeler::TkNN::_nDistance

Referenced by ClassImp().

◆ _nK

Int_t URANIE::Modeler::TkNN::_nK

the number of neighboor to take into account

Referenced by ClassImp(), getK(), and setK().

◆ _sDraw

TString URANIE::Modeler::TkNN::_sDraw

! The distance normalized for input and output

Variables to visualize during the learning process

Referenced by ClassImp().

◆ _tdsQuery

URANIE::DataServer::TDataServer* URANIE::Modeler::TkNN::_tdsQuery

the TDS contins the query points

Referenced by ClassImp().