FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
PndKnnTrain Class Reference

#include <PndKnnTrain.h>

Inheritance diagram for PndKnnTrain:
PndMvaTrainer

Public Member Functions

 PndKnnTrain (std::string const &InputFile, std::vector< std::string > const &ClassNames, std::vector< std::string > const &VarNames, bool trim=true)
 
virtual ~PndKnnTrain ()
 
void Train ()
 
void storeWeights ()
 
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...
 

Private Member Functions

 PndKnnTrain (PndKnnTrain const &other)
 To avoid mistakes. More...
 
PndKnnTrainoperator= (PndKnnTrain const &other)
 

Detailed Description

Definition at line 15 of file PndKnnTrain.h.

Constructor & Destructor Documentation

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

Constructor.

Parameters
InputFileExample event input File name.
ClassNamesClass names for wich the classifier is trained.
VarNamesVariable names creating the feature vector.
virtual PndKnnTrain::~PndKnnTrain ( )
virtual

Class destructor.

PndKnnTrain::PndKnnTrain ( PndKnnTrain const &  other)
private

To avoid mistakes.

Member Function Documentation

virtual void PndMvaTrainer::EvalClassifierError ( )
virtualinherited

Classifier evaluation.

Reimplemented in PndLVQTrain.

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

Get the list of available classes (labels).

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

Definition at line 226 of file PndMvaTrainer.h.

References PndMvaDataSet::GetClasses(), and PndMvaTrainer::m_dataSets.

227 {
228  return m_dataSets.GetClasses();
229 };
PndMvaDataSet m_dataSets
Data set. Holds event values.
std::vector< PndMvaClass > const & GetClasses() const
Get the list of available classes (labels).
std::vector< StepError > const & PndMvaTrainer::GetErrorValues ( ) const
inlineinherited

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

Returns
List of evaluation objects.

Definition at line 238 of file PndMvaTrainer.h.

References PndMvaTrainer::m_StepErro.

239 {
240  return m_StepErro;
241 };
std::vector< StepError > m_StepErro
Container to keep per step error values.
size_t PndMvaTrainer::GetRndSeed ( ) const
inlineinherited

Definition at line 200 of file PndMvaTrainer.h.

References PndMvaTrainer::m_RND_seed.

201 {
202  return this->m_RND_seed;
203 };
size_t m_RND_seed
Random seed.
std::set< size_t > const & PndMvaTrainer::GetTestEvetIdx ( ) const
inlineinherited

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

Returns
A set containing the indices of test events.

Definition at line 220 of file PndMvaTrainer.h.

References PndMvaTrainer::m_testSet_indices.

221 {
222  return m_testSet_indices;
223 };
std::set< size_t > m_testSet_indices
Indices of the test set.
std::vector< PndMvaVariable > const & PndMvaTrainer::GetVariables ( ) const
inlineinherited

Get the list of available variables.

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

Definition at line 232 of file PndMvaTrainer.h.

References PndMvaDataSet::GetVars(), and PndMvaTrainer::m_dataSets.

233 {
234  return m_dataSets.GetVars();
235 };
PndMvaDataSet m_dataSets
Data set. Holds event values.
std::vector< PndMvaVariable > const & GetVars() const
Get the list of available variables.
virtual void PndMvaTrainer::Initialize ( )
virtualinherited

Initialize data structures.

Reimplemented in PndMultiClassBdtTrain, and PndMultiClassMlpTrain.

void PndMvaTrainer::NormalizeData ( NormType  t = NONORM)
inherited

Select input data normalization scheme.

PndKnnTrain& PndKnnTrain::operator= ( PndKnnTrain const &  other)
private
void PndMvaTrainer::PCATransForm ( )
inherited

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

void PndMvaTrainer::SetAppType ( AppType  t)
inlineprotectedinherited

Set application type for the current object

Definition at line 215 of file PndMvaTrainer.h.

References PndMvaTrainer::m_dataSets, and PndMvaDataSet::SetAppType().

216 {
218 };
PndMvaDataSet m_dataSets
Data set. Holds event values.
void SetAppType(AppType t)
TTree * t
Definition: bump_analys.C:13
void PndMvaTrainer::SetOutPutFile ( std::string const &  outFile)
inlineinherited

Setter to set the weightfile name.

Parameters
outFileOutput filename.

Definition at line 210 of file PndMvaTrainer.h.

References PndMvaTrainer::m_outFile, and outFile.

211 {
212  m_outFile = outFile;
213 };
TString outFile
Definition: hit_dirc.C:17
std::string m_outFile
Output filename.
void PndMvaTrainer::SetRndSeed ( size_t const  sd)
inlineinherited

Definition at line 205 of file PndMvaTrainer.h.

References PndMvaTrainer::m_RND_seed.

206 {
207  this->m_RND_seed = sd;
208 };
size_t m_RND_seed
Random seed.
void PndMvaTrainer::SetTestSet ( std::set< size_t > const &  testSet)
inherited

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

Parameters
testSetSet containing the indices of the test events.
void PndMvaTrainer::SetTestSetSize ( size_t  percent = 50)
inherited

Creates test and train data sets.

Parameters
percentPercent of the data set to be used for testing.
void PndMvaTrainer::splitTetsSet ( )
protectedinherited
void PndKnnTrain::storeWeights ( )
virtual

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

Implements PndMvaTrainer.

void PndKnnTrain::Train ( )
virtual

Train the classifier.

Implements PndMvaTrainer.

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

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

Parameters
FileNameOutput file name.
void PndMvaTrainer::WriteToWeightFile ( std::vector< std::pair< std::string, std::vector< float > * > > const &  weights) const
protectedinherited

Write the training and normalization data to outFile.

Member Data Documentation

PndMvaDataSet PndMvaTrainer::m_dataSets
protectedinherited

Data set. Holds event values.

Definition at line 175 of file PndMvaTrainer.h.

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

std::string PndMvaTrainer::m_outFile
protectedinherited

Output filename.

Definition at line 181 of file PndMvaTrainer.h.

Referenced by PndMvaTrainer::SetOutPutFile().

size_t PndMvaTrainer::m_RND_seed
protectedinherited

Random seed.

Definition at line 184 of file PndMvaTrainer.h.

Referenced by PndMvaTrainer::GetRndSeed(), and PndMvaTrainer::SetRndSeed().

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

Container to keep per step error values.

Definition at line 178 of file PndMvaTrainer.h.

Referenced by PndMvaTrainer::GetErrorValues().

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

Indices of the test set.

Definition at line 172 of file PndMvaTrainer.h.

Referenced by PndMvaTrainer::GetTestEvetIdx().


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