Belle II Software  release-08-01-10
Expert.h
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 #pragma once
10 #ifndef INCLUDE_GUARD_BELLE2_MVA_EXPERT_HEADER
11 #define INCLUDE_GUARD_BELLE2_MVA_EXPERT_HEADER
12 
13 #include <mva/interface/Options.h>
14 #include <mva/interface/Dataset.h>
15 #include <mva/interface/Weightfile.h>
16 
17 #include <vector>
18 
19 namespace Belle2 {
24  namespace MVA {
25 
31  class Expert {
32  public:
36  Expert() = default;
37 
42  virtual void load(Weightfile& weightfile) = 0;
43 
48  virtual std::vector<float> apply(Dataset& test_data) const = 0;
49 
56  virtual std::vector<std::vector<float>> applyMulticlass(Dataset& test_data) const
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  };
64 
68  virtual ~Expert() = default;
69  protected:
71  };
72 
73  }
75 }
76 #endif
Abstract base class of all Datasets given to the MVA interface The current event can always be access...
Definition: Dataset.h:33
Abstract base class of all Expert Each MVA library has its own implementation of this class,...
Definition: Expert.h:31
virtual std::vector< float > apply(Dataset &test_data) const =0
Apply this expert onto a dataset.
GeneralOptions m_general_options
General options loaded from the weightfile.
Definition: Expert.h:70
Expert()=default
Default constructor.
virtual void load(Weightfile &weightfile)=0
Load the expert from a Weightfile.
virtual std::vector< std::vector< float > > applyMulticlass(Dataset &test_data) const
Apply this m_expert onto a dataset.
Definition: Expert.h:56
virtual ~Expert()=default
Virtual destructor.
General options which are shared by all MVA trainings.
Definition: Options.h:62
The Weightfile class serializes all information about a training into an xml tree.
Definition: Weightfile.h:38
Abstract base class for different kinds of events.