Expert for the FANN MVA method.
More...
#include <FANN.h>
Expert for the FANN MVA method.
Definition at line 109 of file FANN.h.
◆ ~FANNExpert()
Destructor of FANN Expert.
Definition at line 312 of file FANN.cc.
313 {
316 }
317 }
struct fann * m_ann
Pointer to FANN expert.
◆ apply()
std::vector< float > apply |
( |
Dataset & |
test_data | ) |
const |
|
overridevirtual |
Apply this expert onto a dataset.
- Parameters
-
Implements Expert.
Definition at line 333 of file FANN.cc.
334 {
335
336 std::vector<fann_type> input(test_data.getNumberOfFeatures());
337 std::vector<float> probabilities(test_data.getNumberOfEvents());
338 for (unsigned int iEvent = 0; iEvent < test_data.getNumberOfEvents(); ++iEvent) {
339 test_data.loadEvent(iEvent);
340 for (unsigned int iFeature = 0; iFeature < test_data.getNumberOfFeatures(); ++iFeature) {
341 input[iFeature] = test_data.m_input[iFeature];
342 }
344 probabilities[iEvent] = fann_run(
m_ann, input.data())[0];
345 }
347 return probabilities;
348 }
FANNOptions m_specific_options
Method specific options.
bool m_scale_features
Scale features before training.
bool m_scale_target
Scale target before training.
◆ 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 expert from a Weightfile.
- Parameters
-
weightfile | containing all information necessary to build the expert |
Implements Expert.
Definition at line 319 of file FANN.cc.
320 {
321
322 std::string custom_weightfile = weightfile.generateFileName();
323 weightfile.getFile("FANN_Weightfile", custom_weightfile);
324
327 }
328 m_ann = fann_create_from_file(custom_weightfile.c_str());
329
331 }
◆ m_ann
struct fann* m_ann = nullptr |
|
private |
Pointer to FANN expert.
Definition at line 132 of file FANN.h.
◆ m_general_options
General options loaded from the weightfile.
Definition at line 70 of file Expert.h.
◆ m_specific_options
Method specific options.
Definition at line 131 of file FANN.h.
The documentation for this class was generated from the following files: