English Français

Documentation / Developer's manual

Available modules

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

Implement the Neural Gas algorithm (Martinetz and Schulten, 1991) More...

#include <TNeuralGas.h>

Inheritance diagram for URANIE::Sampler::TNeuralGas:
Collaboration diagram for URANIE::Sampler::TNeuralGas:

Public Member Functions

Constructor and Destructor
 TNeuralGas (URANIE::DataServer::TDataServer *tds, Option_t *option, Int_t ns)
 Constructor with a dataserver.
 
virtual ~TNeuralGas ()
 Default destructor.
 
Setting and Getting attributs
void setLambda (Double_t dinitlambda, Double_t dfinallambda)
 Set the lambda parameters.
 
void setAlpha (Double_t dinitalpha, Double_t dfinalalpha)
 Set the alpha parameters.
 
void setTMax (Int_t dtmax)
 Set the $ t_{max}$ parameter.
 
Int_t getTMax ()
 Get the $ t_{max}$ parameter.
 
State machine

For the stochastic methods, two states can be created init and terminate which are executed just before the generation of the sample for the first one, and after the generation for the second one. They can be used for pre and post treatment purpose.

void init ()
 The preprocessing step.
 
void learn (Int_t index)
 The learning step for the index pattern.
 
Generate the sample

the generate sample procedure

void generateSample (Option_t *option="")
 Generates the sample.
 
Printing Log
virtual void printLog (Option_t *option="")
 Prints the log.
 
- Public Member Functions inherited from URANIE::Sampler::TVQ
 TVQ (URANIE::DataServer::TDataServer *tds, Option_t *option, Int_t ns)
 Constructor with a dataserver.
 
virtual ~TVQ ()
 Default destructor.
 
Bool_t getSaveAll ()
 Returns the flag SaveAll.
 
void setDrawProgressBar (Bool_t bbool=kTRUE)
 Set the "draw progress bar" flag.
 
Bool_t getDrawProgressBar ()
 Get the clean flag.
 
void createListOfAttributes ()
 Creates the list of attributes to select patterns.
 
void shuffle ()
 shuffle the learning database (original TDataServer)
 
URANIE::DataServer::TDataServer * getSubSample (Option_t *option="")
 Generate the Sample and return the TDataServer.
 
virtual void terminate ()
 The post-processing step.
 
- Public Member Functions inherited from URANIE::Sampler::TSamplerStochastic
 TSamplerStochastic (URANIE::DataServer::TDataServer *tds, Option_t *option, Int_t nCalcul)
 Constructor with a dataserver.
 
virtual ~TSamplerStochastic ()
 Default destructor.
 
void setSeed (Int_t ind=0)
 Init the seed.
 
Int_t getSeed ()
 Returns the seed value.
 
- Public Member Functions inherited from URANIE::Sampler::TSampler
 TSampler (URANIE::DataServer::TDataServer *tds, Option_t *option, Int_t nCalcul)
 Constructor with a TDataServer, the options and the size of the sample.
 
virtual ~TSampler ()
 Default destructor.
 
Int_t GetID ()
 Returns the ID of the class.
 
void setMethodName (TString str)
 Sets the method name in a global variable.
 
TString getMethodName ()
 Gets the method name.
 
virtual URANIE::DataServer::TDataServer * getTDS ()
 Return the TDS filling by the sampling algorithm.
 
void parseOption (Option_t *option)
 Parse the option.
 
virtual void createTuple ()
 Creates the TDSNtupleD of data with only the TStochasticAttributes.
 
URANIE::DataServer::TDSNtupleD * getTuple ()
 Returns the TDSNtupleD of data.
 
virtual void fillOtherAttributes ()
 Fills the TDSNtupleD of data with other TFormulaAttributes.
 
void setLog ()
 
void unsetLog ()
 
void changeLog ()
 
Bool_t getLog ()
 

Public Attributes

TMatrixD _datamatrix
 The matrix of data.
 
TMatrixD _dvw
 The matrix of difference.
 
TString _svardraw
 
Int_t _ntemperature
 
Double_t _dtmax
 The $ t_{max}$ parameter.
 
Double_t _dinitlambda
 The initial value of $ \lambda_i $.
 
Double_t _dlambda
 The current value of $ \lambda_i $.
 
Double_t _dfinalambda
 The final value of $ \lambda_f $.
 
Double_t _dinitalpha
 The initial value of $ \alpha_i$.
 
Double_t _dalpha
 The current value of $ \alpha_i$.
 
Double_t _dfinalalpha
 The final value of $ \alpha_f $.
 
- Public Attributes inherited from URANIE::Sampler::TVQ
TVector _vecindexorg
 The vector of index of the database.
 
URANIE::DataServer::TDataServer * _subtds
 The subsampler returened by the getSubSample method.
 
Bool_t _bsaveall
 The boolean to save all the data in the learning (default = kFALSE)
 
TString _sattributes
 the list of attributes
 
- Public Attributes inherited from URANIE::Sampler::TSampler
Int_t _nS
 The size of the sample.
 
Int_t _nX
 The size of attributes to sample.
 
URANIE::DataServer::TDSNtupleD * _ntsample
 the tntuple of data
 
TString _sMethod
 The title of the sampler method.
 
Bool_t _blog
 Log Printing.
 
Bool_t _bupdateFile
 Update the back up file when generating the attributeformula if there is some.
 
URANIE::DataServer::TDataServer * _tds
 Pointer to a TDS.
 
TList * _lstOfAttributesToSample
 The list of Stochastic Attributes to sample.
 

Additional Inherited Members

State machine

For the stochastic methods, two2 states can be created init and terminate which are executed just before the generation of the sample for the first one, and after the generation for the second one. They can be used for pre and post treatment purpose.

- Protected Attributes inherited from URANIE::Sampler::TVQ
URANIE::DataServer::UMessageLogger * _fLogger
 
Bool_t _bdrawProgressBar
 Boolean to know if the progress bar has to be drawn.
 
- Protected Attributes inherited from URANIE::Sampler::TSamplerStochastic
Int_t _nSeed
 

Detailed Description

Implement the Neural Gas algorithm (Martinetz and Schulten, 1991)

The Neural Gas Algorithm (Martinetz and Schulten, 1991) sorts for each input signal $ x $ the units of the network according to the distance of their reference vectors to $ \xi$. Based on this rank order a certain number of units is adapted. Both the number of adapted units and the adaptation strength are decreased according to a fixed schedule.

The reference vectors are adjusted according to

\[
\Delta \xi_j \: = \: \alpha(t) \exp^{-Rank(j)/\lambda(t)} \times (\xi_j - x)
\]

with the following time-dependencies:

\[
\alpha(t) = \alpha_i \; (\frac{\alpha_f}{\alpha_i})^{t/t_{max}}
\]

\[
\lambda(t) = \lambda_i \; (\frac{\lambda_f}{\lambda_i})^{t/t_{max}}
\]

Default values
  • $ t_{max} = 40000$
  • $ \alpha_i = 0.5$
  • $ \alpha_f = 0.005$
  • $ \lambda_f = 0.01$
  • $ \lambda_i = \frac{Card(\xi)-1}{3} $
The initial cluster are selected randomly from the original dataset.

In the subsample dataserver, it exists an internal attribute "__neural__gas_iter__" which contains the number of loop need by the learning process.

Example
TDataServer *tds = new TDataServer("tdsgeyser", "Neural Gas for Geyser dataset");
tds->fileDataRead("geyser.dat");
TNeuralGas * tvq = new TNeuralGas(tds,"", 50);
TDataServer *tdsng = tvq->getSubSample("loop=100");
tds->draw("x2:x1");
tdsng->draw("x2:x1","","same");
Implement the Neural Gas algorithm (Martinetz and Schulten, 1991)
Definition TNeuralGas.h:92
URANIE::DataServer::TDataServer * getSubSample(Option_t *option="")
Generate the Sample and return the TDataServer.
Definition TVQ.cxx:205

Constructor & Destructor Documentation

◆ TNeuralGas()

URANIE::Sampler::TNeuralGas::TNeuralGas ( URANIE::DataServer::TDataServer *  tds,
Option_t *  option,
Int_t  ns 
)

Constructor with a dataserver.

Parameters
tds(URANIE::DataServer::TDataServer *) the original data
option(Option_t) contains the options [default ""]
  • "saveall" Save all the data generate by the algorithm ( _bsaveall = kTRUE).
ns(Int_t) the size of the subsample

References _dinitlambda, URANIE::Sampler::TSampler::_nS, and URANIE::Sampler::TSampler::_tds.

◆ ~TNeuralGas()

URANIE::Sampler::TNeuralGas::~TNeuralGas ( )
virtual

Default destructor.

References URANIE::Sampler::TVQ::_fLogger.

Member Function Documentation

◆ generateSample()

◆ getTMax()

Int_t URANIE::Sampler::TNeuralGas::getTMax ( )
inline

Get the $ t_{max}$ parameter.

References _dtmax.

◆ init()

◆ learn()

◆ printLog()

void URANIE::Sampler::TNeuralGas::printLog ( Option_t *  option = "")
virtual

◆ setAlpha()

void URANIE::Sampler::TNeuralGas::setAlpha ( Double_t  dinitalpha,
Double_t  dfinalalpha 
)
inline

Set the alpha parameters.

Set the initial $ \alpha_i $ and final $ \alpha_f $ alpha parameters where the $ \alpha $ time-dependency is :

\[
\alpha(t) = \alpha_i \; (\frac{\alpha_f}{\alpha_i})^{t/t_{max}} \:\: \forall t \in[0, t_{max}]
\]

References _dfinalalpha, and _dinitalpha.

◆ setLambda()

void URANIE::Sampler::TNeuralGas::setLambda ( Double_t  dinitlambda,
Double_t  dfinallambda 
)
inline

Set the lambda parameters.

Set the initial $ \lambda_i $ and final $ \lambda_f $ lambda parameters where the $ \lambda $ time-dependency is :

\[
\lambda(t) = \lambda_i \; (\frac{\lambda_f}{\lambda_i})^{t/t_{max}} \:\: \forall t \in[0, t_{max}]
\]

References _dfinalambda, and _dinitlambda.

◆ setTMax()

void URANIE::Sampler::TNeuralGas::setTMax ( Int_t  dtmax)
inline

Set the $ t_{max}$ parameter.

References _dtmax.

Member Data Documentation

◆ _dalpha

Double_t URANIE::Sampler::TNeuralGas::_dalpha

The current value of $ \alpha_i$.

Referenced by generateSample(), and learn().

◆ _datamatrix

TMatrixD URANIE::Sampler::TNeuralGas::_datamatrix

The matrix of data.

Referenced by init(), and learn().

◆ _dfinalalpha

Double_t URANIE::Sampler::TNeuralGas::_dfinalalpha

The final value of $ \alpha_f $.

Referenced by generateSample(), printLog(), and setAlpha().

◆ _dfinalambda

Double_t URANIE::Sampler::TNeuralGas::_dfinalambda

The final value of $ \lambda_f $.

Referenced by generateSample(), printLog(), and setLambda().

◆ _dinitalpha

Double_t URANIE::Sampler::TNeuralGas::_dinitalpha

The initial value of $ \alpha_i$.

Referenced by generateSample(), printLog(), and setAlpha().

◆ _dinitlambda

Double_t URANIE::Sampler::TNeuralGas::_dinitlambda

The initial value of $ \lambda_i $.

Referenced by generateSample(), printLog(), setLambda(), and TNeuralGas().

◆ _dlambda

Double_t URANIE::Sampler::TNeuralGas::_dlambda

The current value of $ \lambda_i $.

Referenced by generateSample(), and learn().

◆ _dtmax

Double_t URANIE::Sampler::TNeuralGas::_dtmax

The $ t_{max}$ parameter.

Referenced by generateSample(), getTMax(), learn(), printLog(), and setTMax().

◆ _dvw

TMatrixD URANIE::Sampler::TNeuralGas::_dvw

The matrix of difference.

Referenced by init(), and learn().

◆ _ntemperature

Int_t URANIE::Sampler::TNeuralGas::_ntemperature

Referenced by generateSample(), learn(), and printLog().

◆ _svardraw

TString URANIE::Sampler::TNeuralGas::_svardraw

Referenced by learn().