Belle II Software development
Regression.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <mva/methods/Regression.h>
10
11#include <vector>
12
13using namespace Belle2;
14using namespace MVA;
15
16// cppcheck complains that m_cutValue and m_childDataSet are not initialised, which they obviously are, therefore:
17// cppcheck-suppress uninitMemberVar
18RegressionDataSet::RegressionDataSet(const GeneralOptions& general_options, Dataset* dataset, double cutValue) :
19 Dataset(general_options), m_cutValue(cutValue), m_childDataSet(dataset)
20{
21}
22
23void RegressionDataSet::loadEvent(unsigned int iEvent)
24{
25 m_childDataSet->loadEvent(iEvent);
26 m_input = m_childDataSet->m_input;
27 m_spectators = m_childDataSet->m_spectators;
29 m_target = m_childDataSet->m_target;
30 m_weight = m_childDataSet->m_weight;
31}
32
34{
35 return m_childDataSet->getNumberOfFeatures();
36}
37
39{
40 return m_childDataSet->getNumberOfEvents();
41}
42
44{
45 return m_childDataSet->getNumberOfSpectators();
46}
47
48std::vector<float> RegressionDataSet::getFeature(unsigned int iFeature)
49{
50 return m_childDataSet->getFeature(iFeature);
51}
52
53std::vector<float> RegressionDataSet::getSpectator(unsigned int iSpectator)
54{
55 return m_childDataSet->getSpectator(iSpectator);
56}
57
59{
60 return m_childDataSet->getWeights();
61}
62
64{
65 return m_childDataSet->getTargets();
66}
std::vector< float > m_spectators
Contains all spectators values of the currently loaded event.
Definition Dataset.h:124
std::vector< float > m_input
Contains all feature values of the currently loaded event.
Definition Dataset.h:123
Dataset(const GeneralOptions &general_options)
Constructs a new dataset given the general options.
Definition Dataset.cc:26
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
General options which are shared by all MVA trainings.
Definition Options.h:62
std::vector< float > getTargets() override
Return the targets from the real dataset.
Definition Regression.cc:63
unsigned int getNumberOfEvents() const override
Return the number of events from the real dataset.
Definition Regression.cc:38
std::vector< float > getSpectator(unsigned int iSpectator) override
Return a specific spectator from the real dataset.
Definition Regression.cc:53
unsigned int getNumberOfSpectators() const override
Return the number of spectators from the real dataset.
Definition Regression.cc:43
unsigned int getNumberOfFeatures() const override
Return the number of features from the real dataset.
Definition Regression.cc:33
std::vector< float > getFeature(unsigned int iFeature) override
Return a specific feature from the real dataset.
Definition Regression.cc:48
std::vector< float > getWeights() override
Return the weights from the real dataset.
Definition Regression.cc:58
void loadEvent(unsigned int iEvent) override
Load an event. Sets all internal variables and sets the isSignal variable dependent on the cut value.
Definition Regression.cc:23
Dataset * m_childDataSet
The real data set (our child)
Definition Regression.h:111
double m_cutValue
The cut value.
Definition Regression.h:108
RegressionDataSet(const GeneralOptions &general_options, Dataset *dataSet, double cutValue)
Create a new regression data set out of the general options, a pointer to the real dataset and the cu...
Definition Regression.cc:18
Abstract base class for different kinds of events.