PandaRoot
PndMvaTrainer Class Referenceabstract

#include <PndMvaTrainer.h>

Inheritance diagram for PndMvaTrainer:
PndKnnTrain PndLVQTrain PndMultiClassBdtTrain PndMultiClassMlpTrain PndPDEFoamTrain

Public Member Functions

 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...
 
virtual void Train ()=0
 Derived classes need to implement this methode. More...
 
virtual void storeWeights ()=0
 
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...
 
virtual void EvalClassifierError ()
 
size_t GetRndSeed () const
 
void SetRndSeed (size_t const sd)
 

Protected Member Functions

void SetAppType (AppType t)
 
void WriteToWeightFile (std::vector< std::pair< std::string, std::vector< float > *>> const &weights) const
 
void splitTetsSet ()
 

Protected Attributes

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

Definition at line 33 of file PndMvaTrainer.h.

Constructor & Destructor Documentation

◆ PndMvaTrainer() [1/2]

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 
)
explicit

Constructor.

Parameters
InPutThe input parameters.
ClassNamesNames of available labels(classes).
VarNamesNames of available variables.

◆ PndMvaTrainer() [2/2]

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

Constructor.

Parameters
InPut,Theinput filename.
ClassNamesNames of available classes.
VarNamesNames of available variables.

◆ ~PndMvaTrainer()

virtual PndMvaTrainer::~PndMvaTrainer ( )
virtual

Destructor.

Member Function Documentation

◆ EvalClassifierError()

virtual void PndMvaTrainer::EvalClassifierError ( )
virtual

Classifier evaluation.

Reimplemented in PndLVQTrain.

◆ GetClasses()

std::vector< PndMvaClass > const & PndMvaTrainer::GetClasses ( ) const
inline

Get the list of available classes (labels).

Get the list of available classes (labels). Vector containing available labels.

Definition at line 218 of file PndMvaTrainer.h.

References PndMvaDataSet::GetClasses(), and m_dataSets.

219 {
220  return m_dataSets.GetClasses();
221 };
PndMvaDataSet m_dataSets
Data set. Holds event values.
std::vector< PndMvaClass > const & GetClasses() const
Get the list of available classes (labels).

◆ GetErrorValues()

std::vector< StepError > const & PndMvaTrainer::GetErrorValues ( ) const
inline

Get the list of objects that contain the classifier evaluation results.

Returns
List of evaluation objects.

Definition at line 230 of file PndMvaTrainer.h.

References m_StepErro.

231 {
232  return m_StepErro;
233 };
std::vector< StepError > m_StepErro
Container to keep per step error values.

◆ GetRndSeed()

size_t PndMvaTrainer::GetRndSeed ( ) const
inline

Definition at line 192 of file PndMvaTrainer.h.

References m_RND_seed.

193 {
194  return this->m_RND_seed;
195 };
size_t m_RND_seed
Random seed.

◆ GetTestEvetIdx()

std::set< size_t > const & PndMvaTrainer::GetTestEvetIdx ( ) const
inline

Get the indices of the events selected to be used for testing.

Returns
A set containing the indices of test events.

Definition at line 212 of file PndMvaTrainer.h.

References m_testSet_indices.

213 {
214  return m_testSet_indices;
215 };
std::set< size_t > m_testSet_indices
Indices of the test set.

◆ GetVariables()

std::vector< PndMvaVariable > const & PndMvaTrainer::GetVariables ( ) const
inline

Get the list of available variables.

Get the list of available variables. Vector containing available Parameters (features).

Definition at line 224 of file PndMvaTrainer.h.

References PndMvaDataSet::GetVars(), and m_dataSets.

225 {
226  return m_dataSets.GetVars();
227 };
PndMvaDataSet m_dataSets
Data set. Holds event values.
std::vector< PndMvaVariable > const & GetVars() const
Get the list of available variables.

◆ Initialize()

virtual void PndMvaTrainer::Initialize ( )
virtual

Initialize data structures.

Reimplemented in PndMultiClassBdtTrain, and PndMultiClassMlpTrain.

◆ NormalizeData()

void PndMvaTrainer::NormalizeData ( NormType  t = NONORM)

Select input data normalization scheme.

◆ PCATransForm()

void PndMvaTrainer::PCATransForm ( )

Parameter decorrelation. Performs PCA (Principal component analysis) on the input dataset.

◆ SetAppType()

void PndMvaTrainer::SetAppType ( AppType  t)
inlineprotected

Set application type for the current object

Definition at line 207 of file PndMvaTrainer.h.

References m_dataSets, and PndMvaDataSet::SetAppType().

208 {
210 };
PndMvaDataSet m_dataSets
Data set. Holds event values.
void SetAppType(AppType t)

◆ SetOutPutFile()

void PndMvaTrainer::SetOutPutFile ( std::string const &  outFile)
inline

Setter to set the weightfile name.

Parameters
outFileOutput filename.

Definition at line 202 of file PndMvaTrainer.h.

References m_outFile.

203 {
204  m_outFile = outFile;
205 };
std::string m_outFile
Output filename.

◆ SetRndSeed()

void PndMvaTrainer::SetRndSeed ( size_t const  sd)
inline

Definition at line 197 of file PndMvaTrainer.h.

References m_RND_seed.

198 {
199  this->m_RND_seed = sd;
200 };
size_t m_RND_seed
Random seed.

◆ SetTestSet()

void PndMvaTrainer::SetTestSet ( std::set< size_t > const &  testSet)

Set the indices of events that are going to be used for testing.

Parameters
testSetSet containing the indices of the test events.

◆ SetTestSetSize()

void PndMvaTrainer::SetTestSetSize ( size_t  percent = 50)

Creates test and train data sets.

Parameters
percentPercent of the data set to be used for testing.

◆ splitTetsSet()

void PndMvaTrainer::splitTetsSet ( )
protected

◆ storeWeights()

virtual void PndMvaTrainer::storeWeights ( )
pure virtual

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

Implemented in PndLVQTrain, PndMultiClassBdtTrain, PndMultiClassMlpTrain, and PndKnnTrain.

◆ Train()

virtual void PndMvaTrainer::Train ( )
pure virtual

Derived classes need to implement this methode.

Implemented in PndLVQTrain, PndMultiClassBdtTrain, PndMultiClassMlpTrain, PndKnnTrain, and PndPDEFoamTrain.

◆ WriteErroVect()

void PndMvaTrainer::WriteErroVect ( std::string const &  FileName) const

Writes the train and test errors evaluations to a given file.

Parameters
FileNameOutput file name.

◆ WriteToWeightFile()

void PndMvaTrainer::WriteToWeightFile ( std::vector< std::pair< std::string, std::vector< float > *>> const &  weights) const
protected

Write the training and normalization data to outFile.

Member Data Documentation

◆ m_dataSets

PndMvaDataSet PndMvaTrainer::m_dataSets
protected

Data set. Holds event values.

Definition at line 167 of file PndMvaTrainer.h.

Referenced by GetClasses(), GetVariables(), and SetAppType().

◆ m_outFile

std::string PndMvaTrainer::m_outFile
protected

Output filename.

Definition at line 173 of file PndMvaTrainer.h.

Referenced by SetOutPutFile().

◆ m_RND_seed

size_t PndMvaTrainer::m_RND_seed
protected

Random seed.

Definition at line 176 of file PndMvaTrainer.h.

Referenced by GetRndSeed(), and SetRndSeed().

◆ m_StepErro

std::vector<StepError> PndMvaTrainer::m_StepErro
protected

Container to keep per step error values.

Definition at line 170 of file PndMvaTrainer.h.

Referenced by GetErrorValues().

◆ m_testSet_indices

std::set<size_t> PndMvaTrainer::m_testSet_indices
protected

Indices of the test set.

Definition at line 164 of file PndMvaTrainer.h.

Referenced by GetTestEvetIdx().


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