PandaRoot
PndLVQTrain Class Reference

Interface definition for LVQ trainers. More...

#include <PndLVQTrain.h>

Inheritance diagram for PndLVQTrain:
PndMvaTrainer

Public Member Functions

 PndLVQTrain (std::vector< std::pair< std::string, std::vector< float > *>> const &InputEvtsParam, std::vector< std::string > const &ClassNames, std::vector< std::string > const &VarNames, bool trim=false)
 
 PndLVQTrain (std::string const &InPut, std::vector< std::string > const &ClassNames, std::vector< std::string > const &VarNames, bool trim=true)
 
virtual ~PndLVQTrain ()
 
void storeWeights ()
 
void Train ()
 
void Train21 ()
 
void setProtoInitType (ProtoInitType iniTypeVal=RAND_FROM_DATA)
 
void SetInitProtoFileName (std::string const &fileName)
 
void SetLearnPrameters (double const initConst, double const etZ, double const etF, unsigned int const Nswp)
 
void SetNumberOfProto (size_t const numProto)
 
void SetNumberOfProto (std::map< std::string, size_t > const &labelMap)
 
void SetErrorStepSize (unsigned int const val=1000)
 
void SetLVQ2_1WindowSize (float const Wsize=0.3)
 
void EvalClassifierError ()
 
void SetPerEpochEval (bool val)
 
bool GetPerEpochEval () const
 
- Public Member Functions inherited from PndMvaTrainer
 PndMvaTrainer (std::vector< std::pair< std::string, std::vector< float > *>> const &InputEvtsParam, std::vector< std::string > const &ClassNames, std::vector< std::string > const &VarNames, bool trim=true)
 
 PndMvaTrainer (std::string const &InPut, std::vector< std::string > const &ClassNames, std::vector< std::string > const &VarNames, bool trim=true)
 
virtual ~PndMvaTrainer ()
 Destructor. More...
 
void SetTestSetSize (size_t percent=50)
 
void SetTestSet (std::set< size_t > const &testSet)
 
void NormalizeData (NormType t=NONORM)
 
void PCATransForm ()
 
void SetOutPutFile (std::string const &outFile)
 
void WriteErroVect (std::string const &FileName) const
 
std::vector< StepError > const & GetErrorValues () const
 
virtual void Initialize ()
 
std::set< size_t > const & GetTestEvetIdx () const
 
std::vector< PndMvaClass > const & GetClasses () const
 Get the list of available classes (labels). More...
 
std::vector< PndMvaVariable > const & GetVariables () const
 Get the list of available variables. More...
 
size_t GetRndSeed () const
 
void SetRndSeed (size_t const sd)
 

Additional Inherited Members

- Protected Member Functions inherited from PndMvaTrainer
void SetAppType (AppType t)
 
void WriteToWeightFile (std::vector< std::pair< std::string, std::vector< float > *>> const &weights) const
 
void splitTetsSet ()
 
- Protected Attributes inherited from PndMvaTrainer
std::set< size_t > m_testSet_indices
 Indices of the test set. More...
 
PndMvaDataSet m_dataSets
 Data set. Holds event values. More...
 
std::vector< StepErrorm_StepErro
 Container to keep per step error values. More...
 
std::string m_outFile
 Output filename. More...
 
size_t m_RND_seed
 Random seed. More...
 

Detailed Description

Interface definition for LVQ trainers.

Definition at line 33 of file PndLVQTrain.h.

Constructor & Destructor Documentation

◆ PndLVQTrain() [1/2]

PndLVQTrain::PndLVQTrain ( std::vector< std::pair< std::string, std::vector< float > *>> const &  InputEvtsParam,
std::vector< std::string > const &  ClassNames,
std::vector< std::string > const &  VarNames,
bool  trim = false 
)
explicit

Constructor:

Parameters
InputEvtsParamInput events vector.
ClassNamesclass names.
VarNamesvariable names of the features.

◆ PndLVQTrain() [2/2]

PndLVQTrain::PndLVQTrain ( std::string const &  InPut,
std::vector< std::string > const &  ClassNames,
std::vector< std::string > const &  VarNames,
bool  trim = true 
)
explicit

Constructor:

Parameters
InPutInput file name.
ClassNamesclass names.
VarNamesvariable names of the features.

◆ ~PndLVQTrain()

virtual PndLVQTrain::~PndLVQTrain ( )
virtual

Destructor

Member Function Documentation

◆ EvalClassifierError()

void PndLVQTrain::EvalClassifierError ( )
virtual

Classifier evaluation.

Reimplemented from PndMvaTrainer.

◆ GetPerEpochEval()

bool PndLVQTrain::GetPerEpochEval ( ) const
inline

Getter for evaluation scheme.

Returns
Per epoch or per step.

Definition at line 298 of file PndLVQTrain.h.

299 {
300  return m_PerEpoch;
301 };

◆ SetErrorStepSize()

void PndLVQTrain::SetErrorStepSize ( unsigned int const  val = 1000)
inline

Set how often the classifier has to be evaluated.

Parameters
valEvaluate after #val steps. If (Val == 0) then the classifier is evaluated once at the end of the training prodecure.

Definition at line 283 of file PndLVQTrain.h.

284 {
285  m_ErrorStep = val;
286 };

◆ SetInitProtoFileName()

void PndLVQTrain::SetInitProtoFileName ( std::string const &  fileName)
inline

Set the file name which holds the pre-initialized code books.

Parameters
valThe name of the file which containes the pre initialized code books.

Definition at line 270 of file PndLVQTrain.h.

271 {
272  m_initProtoFile = fileName;
273 };

◆ SetLearnPrameters()

void PndLVQTrain::SetLearnPrameters ( double const  initConst,
double const  etZ,
double const  etF,
unsigned int const  Nswp 
)
inline

Sets the learning parameters.

Parameters
initConstInitialization constant, used to initialize LVQ prototypes.
etZEthaZero, start value for the learning rate.
etFFinal value for Etha (learning rate)
NswpNumber of sweeps through the examples collection set.

Definition at line 275 of file PndLVQTrain.h.

276 {
277  m_initConst = initConst;
278  m_ethaZero = etZ;
279  m_ethaFinal = etF;
280  m_NumSweep = Nswp;
281 };

◆ SetLVQ2_1WindowSize()

void PndLVQTrain::SetLVQ2_1WindowSize ( float const  Wsize = 0.3)
inline

Set the window size for LVQ2.1 alg. A value between 0.2 & 0.3 is recommended.

Definition at line 288 of file PndLVQTrain.h.

289 {
290  m_WindowSize = Wsize;
291 };

◆ SetNumberOfProto() [1/2]

void PndLVQTrain::SetNumberOfProto ( size_t const  numProto)

Set the number of protoTypes to be used for training. The same number of prototypes are initialized for all available labels(classes).

Parameters
numProtoNumber of prototypes.

◆ SetNumberOfProto() [2/2]

void PndLVQTrain::SetNumberOfProto ( std::map< std::string, size_t > const &  labelMap)

Set the number of protoTypes to be used for training.

Parameters
labelMapMap containing number of prototypes for each class (label).

◆ SetPerEpochEval()

void PndLVQTrain::SetPerEpochEval ( bool  val)
inline

Select if we want to follow the training evaluation per epoch (sweeps) or per step. The number of steps = Sweeps * (#examples).

Parameters
valtrue = evaluate per epoch, false per step. Default is false.

Definition at line 293 of file PndLVQTrain.h.

294 {
295  m_PerEpoch = val;
296 };

◆ setProtoInitType()

void PndLVQTrain::setProtoInitType ( ProtoInitType  iniTypeVal = RAND_FROM_DATA)
inline

Set CodeBook init type.

Parameters
iniTypeValInitialization type.

Definition at line 265 of file PndLVQTrain.h.

266 {
267  m_proto_init = iniTypeVal;
268 };

◆ storeWeights()

void PndLVQTrain::storeWeights ( )
virtual

Store weights in the output File. If output file name is not specified, then write nothing.

Implements PndMvaTrainer.

◆ Train()

void PndLVQTrain::Train ( )
virtual

Train the classifier accourding to LVQ1 algorithm.

Implements PndMvaTrainer.

◆ Train21()

void PndLVQTrain::Train21 ( )

Train the classifier accourding to LVQ2.1 algorithm.


The documentation for this class was generated from the following file: