Belle II Software  release-08-01-10
Dataset Class Referenceabstract

Abstract base class of all Datasets given to the MVA interface The current event can always be accessed via the public members of this class. More...

#include <Dataset.h>

Inheritance diagram for Dataset:
Collaboration diagram for Dataset:

Public Member Functions

 Dataset (const GeneralOptions &general_options)
 Constructs a new dataset given the general options. More...
 
virtual ~Dataset ()=default
 Virtual default destructor.
 
 Dataset (const Dataset &)=delete
 Specify no copy constructor.
 
Datasetoperator= (const Dataset &)=delete
 Specify no assignment operator.
 
virtual unsigned int getNumberOfFeatures () const =0
 Returns the number of features in this dataset.
 
virtual unsigned int getNumberOfSpectators () const =0
 Returns the number of spectators in this dataset.
 
virtual unsigned int getNumberOfEvents () const =0
 Returns the number of events in this dataset.
 
virtual void loadEvent (unsigned int iEvent)=0
 Load the event number iEvent. More...
 
virtual float getSignalFraction ()
 Returns the signal fraction of the whole sample.
 
virtual unsigned int getFeatureIndex (const std::string &feature)
 Return index of feature with the given name. More...
 
virtual unsigned int getSpectatorIndex (const std::string &spectator)
 Return index of spectator with the given name. More...
 
virtual std::vector< float > getFeature (unsigned int iFeature)
 Returns all values of one feature in a std::vector<float> More...
 
virtual std::vector< float > getSpectator (unsigned int iSpectator)
 Returns all values of one spectator in a std::vector<float> More...
 
virtual std::vector< float > getWeights ()
 Returns all weights.
 
virtual std::vector< float > getTargets ()
 Returns all targets.
 
virtual std::vector< bool > getSignals ()
 Returns all is Signals.
 

Public Attributes

GeneralOptions m_general_options
 GeneralOptions passed to this dataset.
 
std::vector< float > m_input
 Contains all feature values of the currently loaded event.
 
std::vector< float > m_spectators
 Contains all spectators values of the currently loaded event.
 
float m_weight
 Contains the weight of the currently loaded event.
 
float m_target
 Contains the target value of the currently loaded event.
 
bool m_isSignal
 Defines if the currently loaded event is signal or background.
 

Detailed Description

Abstract base class of all Datasets given to the MVA interface The current event can always be accessed via the public members of this class.

Definition at line 33 of file Dataset.h.

Constructor & Destructor Documentation

◆ Dataset()

Dataset ( const GeneralOptions general_options)
explicit

Constructs a new dataset given the general options.

Parameters
general_optionswhich defines e.g. number of variables

Definition at line 26 of file Dataset.cc.

26  : m_general_options(general_options)
27  {
28  m_input.resize(m_general_options.m_variables.size(), 0);
30  m_target = 0.0;
31  m_weight = 1.0;
32  m_isSignal = false;
33  }
std::vector< float > m_spectators
Contains all spectators values of the currently loaded event.
Definition: Dataset.h:124
GeneralOptions m_general_options
GeneralOptions passed to this dataset.
Definition: Dataset.h:122
std::vector< float > m_input
Contains all feature values of the currently loaded event.
Definition: Dataset.h:123
bool m_isSignal
Defines if the currently loaded event is signal or background.
Definition: Dataset.h:127
float m_weight
Contains the weight of the currently loaded event.
Definition: Dataset.h:125
float m_target
Contains the target value of the currently loaded event.
Definition: Dataset.h:126
std::vector< std::string > m_variables
Vector of all variables (branch names) used in the training.
Definition: Options.h:86
std::vector< std::string > m_spectators
Vector of all spectators (branch names) used in the training.
Definition: Options.h:87

Member Function Documentation

◆ getFeature()

std::vector< float > getFeature ( unsigned int  iFeature)
virtual

Returns all values of one feature in a std::vector<float>

Parameters
iFeaturethe position of the feature to return

Reimplemented in SidebandDataset, ReweightingDataset, RegressionDataSet, ROOTDataset, CombinedDataset, SubDataset, and SingleDataset.

Definition at line 74 of file Dataset.cc.

◆ getFeatureIndex()

unsigned int getFeatureIndex ( const std::string &  feature)
virtual

Return index of feature with the given name.

Parameters
featurename of the feature

Definition at line 50 of file Dataset.cc.

◆ getSpectator()

std::vector< float > getSpectator ( unsigned int  iSpectator)
virtual

Returns all values of one spectator in a std::vector<float>

Parameters
iSpectatorthe position of the feature to return

Reimplemented in SidebandDataset, ReweightingDataset, RegressionDataSet, ROOTDataset, CombinedDataset, SubDataset, and SingleDataset.

Definition at line 86 of file Dataset.cc.

◆ getSpectatorIndex()

unsigned int getSpectatorIndex ( const std::string &  spectator)
virtual

Return index of spectator with the given name.

Parameters
spectatorname of the spectator

Definition at line 62 of file Dataset.cc.

◆ loadEvent()

virtual void loadEvent ( unsigned int  iEvent)
pure virtual

Load the event number iEvent.

Parameters
iEventevent number to load

Implemented in SingleDataset, RegressionDataSet, CombinedDataset, SubDataset, MultiDataset, SPlotDataset, SidebandDataset, ReweightingDataset, and ROOTDataset.


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