Belle II Software prerelease-10-00-00a
MVAExpert.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#pragma once
9
10#include <mva/dataobjects/DatabaseRepresentationOfWeightfile.h>
11#include <tracking/trackFindingVXD/utilities/Named.h>
12#include <mva/interface/Weightfile.h>
13#include <mva/interface/Expert.h>
14
15#include <framework/database/DBObjPtr.h>
16
17
18namespace Belle2 {
23
25 namespace MVA {
26 class Expert;
27 class Weightfile;
28 }
29
33 class MVAExpert {
34 public:
41 MVAExpert(const std::string& identifier, std::vector<Named<float*>> namedVariables);
42
44 void initialize();
45
47 void beginRun();
48
50 std::unique_ptr<MVA::Weightfile> getWeightFile();
51
53 float predict();
54
55 private:
57 std::vector<Named<float*>> m_allNamedVariables;
58
60 std::vector<Named<float*>> m_selectedNamedVariables;
61
63 std::unique_ptr<DBObjPtr<DatabaseRepresentationOfWeightfile> > m_weightfileRepresentation;
64
66 std::unique_ptr<MVA::Expert> m_expert;
67
69 std::unique_ptr<MVA::Dataset> m_dataset;
70
72 std::string m_identifier;
73 };
74
75}
Database representation of a Weightfile object.
void initialize()
Initialise the mva method.
Definition MVAExpert.cc:27
void beginRun()
Update the mva method to the new run.
Definition MVAExpert.cc:38
std::unique_ptr< DBObjPtr< DatabaseRepresentationOfWeightfile > > m_weightfileRepresentation
Database pointer to the Database representation of the weightfile.
Definition MVAExpert.h:63
MVAExpert(const std::string &identifier, std::vector< Named< float * > > namedVariables)
Construct the Expert with the specified weight folder and the name of the training that was used in t...
Definition MVAExpert.cc:20
std::unique_ptr< MVA::Weightfile > getWeightFile()
Resolves the source of the weight file and unpacks it.
Definition MVAExpert.cc:87
std::unique_ptr< MVA::Expert > m_expert
Pointer to the current MVA Expert.
Definition MVAExpert.h:66
std::vector< Named< float * > > m_selectedNamedVariables
References to the selected named values from the source variable set.
Definition MVAExpert.h:60
std::unique_ptr< MVA::Dataset > m_dataset
Pointer to the current dataset.
Definition MVAExpert.h:69
float predict()
Evaluate the MVA method and return the MVAOutput.
Definition MVAExpert.cc:98
std::vector< Named< float * > > m_allNamedVariables
References to the named values from the source variable set.
Definition MVAExpert.h:57
std::string m_identifier
DB identifier of the expert or file name.
Definition MVAExpert.h:72
Abstract base class of all Expert Each MVA library has its own implementation of this class,...
Definition Expert.h:31
The Weightfile class serializes all information about a training into an xml tree.
Definition Weightfile.h:38
A mixin class to attach a name to an object. Based on class with same name in CDC package.
Definition Named.h:21
Abstract base class for different kinds of events.