Expert for the PDF MVA method.
More...
#include <PDF.h>
|
virtual void | load (Weightfile &weightfile) override |
| Load the PDF expert from a Weightfile.
|
|
virtual std::vector< float > | apply (Dataset &test_data) const override |
| Apply PDF expert onto a dataset.
|
|
virtual std::vector< std::vector< float > > | applyMulticlass (Dataset &test_data) const |
| Apply this m_expert onto a dataset.
|
|
Expert for the PDF MVA method.
Definition at line 86 of file PDF.h.
◆ apply()
std::vector< float > apply |
( |
Dataset & |
test_data | ) |
const |
|
overridevirtual |
Apply PDF expert onto a dataset.
- Parameters
-
Implements Expert.
Definition at line 143 of file PDF.cc.
144 {
145 std::vector<float> probabilities(test_data.getNumberOfEvents(), 0);
146 for (unsigned int iEvent = 0; iEvent < test_data.getNumberOfEvents(); ++iEvent) {
147 test_data.loadEvent(iEvent);
149 probabilities[iEvent] =
m_value[bin];
150 }
151 return probabilities;
152 }
unsigned int getBin(float datapoint) const
Gets the bin corresponding to the given datapoint.
Binning m_binning
used binning
std::vector< double > m_value
value returned by expert for each bin
◆ applyMulticlass()
virtual std::vector< std::vector< float > > applyMulticlass |
( |
Dataset & |
test_data | ) |
const |
|
inlinevirtualinherited |
Apply this m_expert onto a dataset.
Multiclass mode. Not pure virtual, since not all derived classes to re-implement this.
- Parameters
-
- Returns
- vector of size N=test_data.getNumberOfEvents() with N=m_classes.size() scores for each event in the dataset.
Reimplemented in PythonExpert, TMVAExpertMulticlass, and TrivialExpert.
Definition at line 56 of file Expert.h.
57 {
58
59 B2ERROR("Attempted to call applyMulticlass() of the abstract base class MVA::Expert. All methods that support multiclass classification should override this definition.");
60 (void) test_data;
61
62 return std::vector<std::vector<float>>();
63 };
◆ load()
Load the PDF expert from a Weightfile.
- Parameters
-
weightfile | containing all information necessary to build the expert |
Implements Expert.
Definition at line 118 of file PDF.cc.
119 {
120
121 std::string custom_weightfile = weightfile.generateFileName();
122 weightfile.getFile("PDF_Weightfile", custom_weightfile);
123 std::fstream file(custom_weightfile, std::ios_base::in);
124
125 unsigned int nBins = 0;
126 file >> nBins;
128
129 std::vector<float> boundaries(nBins + 1, 0);
130
131 for (unsigned int iBin = 0; iBin < nBins; ++iBin) {
132 file >>
m_value[iBin] >> boundaries[iBin];
133 }
134 file >> boundaries[nBins];
135
137
138 file.close();
139
141 }
std::vector< float > m_boundaries
Boundaries of data distribution, including minimum and maximum value as first and last boundary.
PDFOptions m_specific_options
Specific options of the PDF method.
◆ m_binning
used binning
Definition at line 103 of file PDF.h.
◆ m_general_options
General options loaded from the weightfile.
Definition at line 70 of file Expert.h.
◆ m_specific_options
Specific options of the PDF method.
Definition at line 102 of file PDF.h.
◆ m_value
std::vector<double> m_value |
|
private |
value returned by expert for each bin
Definition at line 104 of file PDF.h.
The documentation for this class was generated from the following files: