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

Wraps another Dataset and provides a view to a subset of its features and events. More...

#include <Dataset.h>

Inheritance diagram for SubDataset:
Collaboration diagram for SubDataset:

Public Member Functions

 SubDataset (const GeneralOptions &general_options, const std::vector< bool > &events, Dataset &dataset)
 Constructs a new SubDataset holding a reference to the wrapped Dataset. More...
 
virtual unsigned int getNumberOfFeatures () const override
 Returns the number of features in this dataset, so the size of the given subset of the variables.
 
virtual unsigned int getNumberOfSpectators () const override
 Returns the number of spectators in this dataset, so the size of the given subset of the spectators.
 
virtual unsigned int getNumberOfEvents () const override
 Returns the number of events in the wrapped dataset.
 
virtual void loadEvent (unsigned int iEvent) override
 Load the event number iEvent from the wrapped dataset. More...
 
virtual std::vector< float > getFeature (unsigned int iFeature) override
 Returns all values of one feature in a std::vector<float> of the wrapped dataset. More...
 
virtual std::vector< float > getSpectator (unsigned int iSpectator) override
 Returns all values of one spectator in a std::vector<float> of the wrapped dataset. 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.
 

Private Attributes

bool m_use_event_indices = false
 Use only a subset of the wrapped dataset events.
 
std::vector< unsigned int > m_feature_indices
 Mapping from the position of a feature in the given subset to its position in the wrapped dataset.
 
std::vector< unsigned int > m_spectator_indices
 Mapping from the position of a spectator in the given subset to its position in the wrapped dataset.
 
std::vector< unsigned int > m_event_indices
 Mapping from the position of a event in the given subset to its position in the wrapped dataset.
 
Datasetm_dataset
 Reference to the wrapped dataset.
 

Detailed Description

Wraps another Dataset and provides a view to a subset of its features and events.

Used by the Combination method which can combine multiple methods with possibly different variables

Definition at line 234 of file Dataset.h.

Constructor & Destructor Documentation

◆ SubDataset()

SubDataset ( const GeneralOptions general_options,
const std::vector< bool > &  events,
Dataset dataset 
)

Constructs a new SubDataset holding a reference to the wrapped Dataset.

Parameters
general_optionswhich defines e.g. a subset of variables of the original dataset
eventssubset of events which are provided by this Dataset
datasetreference to the wrapped Dataset

Definition at line 186 of file Dataset.cc.

Member Function Documentation

◆ getFeature()

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

Returns all values of one feature in a std::vector<float> of the wrapped dataset.

Parameters
iFeaturethe position of the feature to return in the given subset

Reimplemented from Dataset.

Definition at line 245 of file Dataset.cc.

◆ 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()

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

Returns all values of one spectator in a std::vector<float> of the wrapped dataset.

Parameters
iSpectatorthe position of the spectator to return in the given subset

Reimplemented from Dataset.

Definition at line 259 of file Dataset.cc.

◆ 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.

◆ loadEvent()

void loadEvent ( unsigned int  iEvent)
overridevirtual

Load the event number iEvent from the wrapped dataset.

Parameters
iEventevent number to load

Implements Dataset.

Definition at line 225 of file Dataset.cc.


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