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

#include <PndMvaDataSet.h>

Public Member Functions

 PndMvaDataSet (std::vector< std::pair< std::string, std::vector< float > * > > const &InputEvtsParam, std::vector< std::string > const &classNames, std::vector< std::string > const &varNames, AppType type)
 
 PndMvaDataSet (std::string const &WeightFile, std::vector< std::string > const &classNames, std::vector< std::string > const &varNames, AppType type)
 
virtual ~PndMvaDataSet ()
 Destructor. More...
 
virtual void WriteDataSet (std::string const &outFile)
 
virtual void InitClsCondMeans (std::set< size_t > const &excludeIndxs)
 
void SetTrim (bool t)
 
std::vector< std::pair
< std::string, std::vector
< float > * > > const & 
GetData () const
 Get available data vectors. More...
 
std::vector< PndMvaClass > const & GetClasses () const
 Get the list of available classes (labels). More...
 
std::vector< PndMvaVariable >
const & 
GetVars () const
 Get the list of available variables. More...
 
std::map< std::string,
std::vector< float > * > const & 
GetClassCondMeans () const
 Get classconditional means for all classes (labels). More...
 
std::string const & GetInFileName () const
 Get name of input file name (weight/event file). More...
 
virtual void PCATransForm ()
 
bool Used_PCA () const
 
void Use_PCA (bool t)
 
PndMvaVarPCATransform const & Get_PCA () const
 
NormType GetNormType () const
 
void SetNormType (NormType t)
 
AppType GetAppType () const
 
void SetAppType (AppType t)
 
virtual void Initialize ()
 
size_t GetRndSeed () const
 
void SetRndSeed (size_t const sd)
 

Protected Member Functions

void ReadInput ()
 
void ReadWeightsFromFile ()
 

Private Member Functions

 PndMvaDataSet (PndMvaDataSet const &other)
 
PndMvaDataSetoperator= (PndMvaDataSet const &other)
 
void Trim ()
 
void NormalizeDataSet ()
 
void InitClasses (std::vector< std::string > const &labels)
 
void InitVariables (std::vector< std::string > const &variables)
 
void ValidateWeightFile ()
 
void CompClsCondMean (std::string const &clsName, std::set< size_t > const &exCluds)
 
void ComputeVariance ()
 
void DetermineMedian ()
 
void MinMaxDiff ()
 
void FindMinMax ()
 
void VarNormalize ()
 

Private Attributes

std::string m_input
 Input File name. More...
 
std::vector< PndMvaClassm_classes
 Classes. More...
 
std::vector< PndMvaVariablem_vars
 Variables. More...
 
std::vector< std::pair
< std::string, std::vector
< float > * > > 
m_events
 Container to keep the Event data feature vectors. More...
 
std::map< std::string,
std::vector< float > * > 
m_ClassCondMeans
 Container to keep the Class Conditional means. More...
 
PndMvaVarPCATransform m_PCA
 
bool m_UsePCA
 
NormType m_NormType
 
AppType m_AppType
 
bool m_trim
 
size_t m_RND_seed
 

Detailed Description

Definition at line 88 of file PndMvaDataSet.h.

Constructor & Destructor Documentation

PndMvaDataSet::PndMvaDataSet ( std::vector< std::pair< std::string, std::vector< float > * > > const &  InputEvtsParam,
std::vector< std::string > const &  classNames,
std::vector< std::string > const &  varNames,
AppType  type 
)
explicit

Constructor.

Parameters
InputEvtsParamInput event data (attributes).
classNamesNames of available Labels (classes).
varNamesAvailable variable names.
typeApplication Type.

Note: The data from "InputEvtsParam" is copied into the internal container. Use with caution in case of large data sets.

PndMvaDataSet::PndMvaDataSet ( std::string const &  WeightFile,
std::vector< std::string > const &  classNames,
std::vector< std::string > const &  varNames,
AppType  type 
)
explicit

Constructor.

Parameters
inputFilenameInput File name.
classNamesNames of available Labels (classes).
varNamesAvailable variable names.
typeApplication Type.
virtual PndMvaDataSet::~PndMvaDataSet ( )
virtual

Destructor.

PndMvaDataSet::PndMvaDataSet ( PndMvaDataSet const &  other)
private

Member Function Documentation

void PndMvaDataSet::CompClsCondMean ( std::string const &  clsName,
std::set< size_t > const &  exCluds 
)
private

Class conditional mean for a given label (class). Stored in class conditional means container.

Parameters
clsNameLabel for which CCM is computed.
exCludsSet of indices of events that are not to be used.
void PndMvaDataSet::ComputeVariance ( )
private

Computes Variance (unbiased estimator) for each parameter in the feature list.

void PndMvaDataSet::DetermineMedian ( )
private

Determines the median for parameters of the loaded DataSet.

void PndMvaDataSet::FindMinMax ( )
private

Find minimum and maximum per variable.

PndMvaVarPCATransform const & PndMvaDataSet::Get_PCA ( ) const
inline

Get PCA object

Returns
PCA object containing PCA parameters.

Definition at line 369 of file PndMvaDataSet.h.

References m_PCA.

370 {
371  return m_PCA;
372 };
PndMvaVarPCATransform m_PCA
AppType PndMvaDataSet::GetAppType ( ) const
inline
Returns
Application type.

Definition at line 381 of file PndMvaDataSet.h.

References m_AppType.

382 {
383  return m_AppType;
384 };
AppType m_AppType
std::map< std::string, std::vector< float > * > const & PndMvaDataSet::GetClassCondMeans ( ) const
inline

Get classconditional means for all classes (labels).

Definition at line 351 of file PndMvaDataSet.h.

References m_ClassCondMeans.

352 {
353  return m_ClassCondMeans;
354 };
std::map< std::string, std::vector< float > * > m_ClassCondMeans
Container to keep the Class Conditional means.
std::vector< PndMvaClass > const & PndMvaDataSet::GetClasses ( ) const
inline

Get the list of available classes (labels).

Definition at line 341 of file PndMvaDataSet.h.

References m_classes.

Referenced by PndMvaClassifier::GetClasses(), and PndMvaTrainer::GetClasses().

342 {
343  return m_classes;
344 };
std::vector< PndMvaClass > m_classes
Classes.
std::vector< std::pair< std::string, std::vector< float > * > > const & PndMvaDataSet::GetData ( ) const
inline

Get available data vectors.

Definition at line 335 of file PndMvaDataSet.h.

References m_events.

336 {
337  assert(m_events.size() != 0);
338  return m_events;
339 };
std::vector< std::pair< std::string, std::vector< float > * > > m_events
Container to keep the Event data feature vectors.
std::string const & PndMvaDataSet::GetInFileName ( ) const
inline

Get name of input file name (weight/event file).

Definition at line 356 of file PndMvaDataSet.h.

References m_input.

357 {
358  return m_input;
359 };
std::string m_input
Input File name.
NormType PndMvaDataSet::GetNormType ( ) const
inline

Normalization type.

Definition at line 373 of file PndMvaDataSet.h.

References m_NormType.

374 {
375  return m_NormType;
376 };
NormType m_NormType
size_t PndMvaDataSet::GetRndSeed ( ) const
inline

Definition at line 325 of file PndMvaDataSet.h.

References m_RND_seed.

326 {
327  return this->m_RND_seed;
328 };
std::vector< PndMvaVariable > const & PndMvaDataSet::GetVars ( ) const
inline

Get the list of available variables.

Definition at line 346 of file PndMvaDataSet.h.

References m_vars.

Referenced by PndMvaClassifier::GetVariables(), and PndMvaTrainer::GetVariables().

347 {
348  return m_vars;
349 };
std::vector< PndMvaVariable > m_vars
Variables.
void PndMvaDataSet::InitClasses ( std::vector< std::string > const &  labels)
private

Init labels (class names).

Parameters
labelsThe list of labels to use.
virtual void PndMvaDataSet::InitClsCondMeans ( std::set< size_t > const &  excludeIndxs)
virtual

Initialize the class conditional means vectors and modifies the attributes of the available labels for this data set (PndMvaClass::NTrainEx); these are the events that are not to be excluded. These events are specified by the exclude indices set.

Parameters
excludeIndxsThe set of event indices to exclude during the computation.
virtual void PndMvaDataSet::Initialize ( )
virtual

Init Dataset. Determine how to handle input, based on the application type.

void PndMvaDataSet::InitVariables ( std::vector< std::string > const &  variables)
private

Init Variables.

Parameters
variablesThe list of variables to use.
void PndMvaDataSet::MinMaxDiff ( )
private

Determine Min Max difference.

void PndMvaDataSet::NormalizeDataSet ( )
private

Normalize event dataset using one of available methods.

PndMvaDataSet& PndMvaDataSet::operator= ( PndMvaDataSet const &  other)
private
virtual void PndMvaDataSet::PCATransForm ( )
virtual

Parameter decorrelation.

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

void PndMvaDataSet::ReadInput ( )
protected

Read input event data.

void PndMvaDataSet::ReadWeightsFromFile ( )
protected

Read Weights and parameters from file.

void PndMvaDataSet::SetAppType ( AppType  t)
inline
Parameters
tApplication type.

Definition at line 385 of file PndMvaDataSet.h.

References m_AppType, and t.

Referenced by PndMvaClassifier::SetAppType(), and PndMvaTrainer::SetAppType().

386 {
387  m_AppType = t;
388 };
AppType m_AppType
TTree * t
Definition: bump_analys.C:13
void PndMvaDataSet::SetNormType ( NormType  t)
inline
Parameters
tNormalization type (VARX, MINMAX, MEDIAN).

Definition at line 377 of file PndMvaDataSet.h.

References m_NormType, and t.

378 {
379  m_NormType = t;
380 };
NormType m_NormType
TTree * t
Definition: bump_analys.C:13
void PndMvaDataSet::SetRndSeed ( size_t const  sd)
inline

Definition at line 330 of file PndMvaDataSet.h.

References m_RND_seed.

331 {
332  this->m_RND_seed = sd;
333 };
void PndMvaDataSet::SetTrim ( bool  t)
inline

If trimming is needed.

Parameters
tIf trim.

Definition at line 389 of file PndMvaDataSet.h.

References m_trim, and t.

390 {
391  m_trim = t;
392 };
TTree * t
Definition: bump_analys.C:13
void PndMvaDataSet::Trim ( )
private

Creates a data set with equal number of events for each class.

void PndMvaDataSet::Use_PCA ( bool  t)
inline
Parameters
tIf apply PCA.

Definition at line 365 of file PndMvaDataSet.h.

References m_UsePCA, and t.

366 {
367  m_UsePCA = t;
368 };
TTree * t
Definition: bump_analys.C:13
bool PndMvaDataSet::Used_PCA ( ) const
inline
Returns
If PCA was applied.

Definition at line 361 of file PndMvaDataSet.h.

References m_UsePCA.

362 {
363  return m_UsePCA;
364 };
void PndMvaDataSet::ValidateWeightFile ( )
private
void PndMvaDataSet::VarNormalize ( )
private

VariableNormalizeTransform. Linear interpolation.

virtual void PndMvaDataSet::WriteDataSet ( std::string const &  outFile)
virtual

Write the normalized DataSet to the out-put file.

Parameters
outFileFile name to write to

Member Data Documentation

AppType PndMvaDataSet::m_AppType
private

Definition at line 317 of file PndMvaDataSet.h.

Referenced by GetAppType(), and SetAppType().

std::map< std::string, std::vector<float>* > PndMvaDataSet::m_ClassCondMeans
private

Container to keep the Class Conditional means.

Definition at line 305 of file PndMvaDataSet.h.

Referenced by GetClassCondMeans().

std::vector<PndMvaClass> PndMvaDataSet::m_classes
private

Classes.

Definition at line 296 of file PndMvaDataSet.h.

Referenced by GetClasses().

std::vector< std::pair<std::string, std::vector<float>*> > PndMvaDataSet::m_events
private

Container to keep the Event data feature vectors.

Definition at line 302 of file PndMvaDataSet.h.

Referenced by GetData().

std::string PndMvaDataSet::m_input
private

Input File name.

Definition at line 293 of file PndMvaDataSet.h.

Referenced by GetInFileName().

NormType PndMvaDataSet::m_NormType
private

Definition at line 314 of file PndMvaDataSet.h.

Referenced by GetNormType(), and SetNormType().

PndMvaVarPCATransform PndMvaDataSet::m_PCA
private

Definition at line 308 of file PndMvaDataSet.h.

Referenced by Get_PCA().

size_t PndMvaDataSet::m_RND_seed
private

Definition at line 319 of file PndMvaDataSet.h.

Referenced by GetRndSeed(), and SetRndSeed().

bool PndMvaDataSet::m_trim
private

Definition at line 318 of file PndMvaDataSet.h.

Referenced by SetTrim().

bool PndMvaDataSet::m_UsePCA
private

Definition at line 311 of file PndMvaDataSet.h.

Referenced by Use_PCA(), and Used_PCA().

std::vector<PndMvaVariable> PndMvaDataSet::m_vars
private

Variables.

Definition at line 299 of file PndMvaDataSet.h.

Referenced by GetVars().


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