Belle II Software  release-08-01-10
SingleDataset Class Reference

Wraps the data of a single event into a Dataset. More...

#include <Dataset.h>

Inheritance diagram for SingleDataset:
Collaboration diagram for SingleDataset:

Public Member Functions

 SingleDataset (const GeneralOptions &general_options, const std::vector< float > &input, float target=1.0, const std::vector< float > &spectators=std::vector< float >())
 Constructs a new SingleDataset. More...
 
virtual unsigned int getNumberOfFeatures () const override
 Returns the number of features in this dataset.
 
virtual unsigned int getNumberOfSpectators () const override
 Returns the number of features in this dataset.
 
virtual unsigned int getNumberOfEvents () const override
 Returns the number of events in this dataset which is always one.
 
virtual void loadEvent (unsigned int) override
 Does nothing in the case of a single dataset, because the only event is already loaded.
 
virtual std::vector< float > getFeature (unsigned int iFeature) override
 Returns all values (in this case only one) of one feature in a std::vector<float> More...
 
virtual std::vector< float > getSpectator (unsigned int iSpectator) override
 Returns all values (in this case only one) of one spectator in a std::vector<float> 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 > 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

Wraps the data of a single event into a Dataset.

Mostly useful if one wants to apply an Expert to a single feature vector

Definition at line 135 of file Dataset.h.

Constructor & Destructor Documentation

◆ SingleDataset()

SingleDataset ( const GeneralOptions general_options,
const std::vector< float > &  input,
float  target = 1.0,
const std::vector< float > &  spectators = std::vector<float>() 
)

Constructs a new SingleDataset.

Parameters
general_optionswhich defines e.g. number of variables
inputfeature values of the single event
spectatorsspectator values of the single event
targettarget value of the single event (defaults to 1, because often this is not known if one wants to apply an expert)

Definition at line 135 of file Dataset.cc.

Member Function Documentation

◆ getFeature()

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

Returns all values (in this case only one) of one feature in a std::vector<float>

Parameters
iFeaturethe position of the feature to return

Reimplemented from Dataset.

Definition at line 172 of file Dataset.h.

172 { return std::vector<float> {m_input[iFeature]}; }
std::vector< float > m_input
Contains all feature values of the currently loaded event.
Definition: Dataset.h:123

◆ getFeatureIndex()

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

Return index of feature with the given name.

Parameters
featurename of the feature

Definition at line 50 of file Dataset.cc.

◆ getSpectator()

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

Returns all values (in this case only one) of one spectator in a std::vector<float>

Parameters
iSpectatorthe position of the spectator to return

Reimplemented from Dataset.

Definition at line 178 of file Dataset.h.

◆ getSpectatorIndex()

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

Return index of spectator with the given name.

Parameters
spectatorname of the spectator

Definition at line 62 of file Dataset.cc.


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