PandaRoot
PndMvaClassifier.h
Go to the documentation of this file.
1 /* **********************************************
2  * MVA classifiers interface. *
3  * Author: M.Babai@rug.nl *
4  * LICENSE: *
5  * Version: *
6  * License: *
7  * **********************************************
8  */
9 //#pragma once
10 #ifndef PND_MVA_CLASSIFIER_H
11 #define PND_MVA_CLASSIFIER_H
12 
13 // C++ includes
14 #include <iostream>
15 #include <vector>
16 #include <map>
17 #include <utility>
18 #include <algorithm>
19 #include <cmath>
20 #include <cassert>
21 
22 // PND PID includes.
23 #include "PndMvaDataSet.h"
24 #include "PndMvaUtil.h"
25 
30  public:
32 
37  explicit PndMvaClassifier(std::string const &InPut, std::vector<std::string> const &ClassNames, std::vector<std::string> const &VarNames);
39  virtual ~PndMvaClassifier();
40 
46  virtual void GetMvaValues(std::vector<float> EvtData, std::map<std::string, float> &result) = 0;
51  virtual std::string *Classify(std::vector<float> EvtData) = 0;
52 
53  // virtual std::string *Classify( std::vector<float> EvtData,
54  // std::map<std::string, float>& result ) = 0;
55 
56  virtual void Initialize();
57 
59  inline std::vector<PndMvaClass> const &GetClasses() const;
60 
62  inline std::vector<PndMvaVariable> const &GetVariables() const;
63 
64  protected:
66  virtual void NormalizeEvent(std::vector<float> &EvtVector) const;
67 
68  inline void SetAppType(AppType t);
69 
72 
73  private:
74  // To avoid mistakes.
75  PndMvaClassifier(PndMvaClassifier const &other);
76  PndMvaClassifier &operator=(PndMvaClassifier const &other);
77 };
78 
80 {
82 };
83 // End of class interface
84 //___________________ Inline implement ___________
86 inline std::vector<PndMvaClass> const &PndMvaClassifier::GetClasses() const
87 {
88  return m_dataSets.GetClasses();
89 };
90 
92 inline std::vector<PndMvaVariable> const &PndMvaClassifier::GetVariables() const
93 {
94  return m_dataSets.GetVars();
95 };
96 #endif
PndMvaClassifier(std::string const &InPut, std::vector< std::string > const &ClassNames, std::vector< std::string > const &VarNames)
Constructor.
void SetAppType(AppType t)
virtual void GetMvaValues(std::vector< float > EvtData, std::map< std::string, float > &result)=0
std::vector< PndMvaVariable > const & GetVars() const
Get the list of available variables.
void SetAppType(AppType t)
PndMvaDataSet m_dataSets
Data set. Holds event Weights.
virtual std::string * Classify(std::vector< float > EvtData)=0
std::vector< PndMvaClass > const & GetClasses() const
Get the list of available classes (labels).
virtual void Initialize()
std::vector< PndMvaVariable > const & GetVariables() const
Get the list of available variables.
virtual ~PndMvaClassifier()
Destructor.
virtual void NormalizeEvent(std::vector< float > &EvtVector) const
Normalize the given event vector.
std::vector< PndMvaClass > const & GetClasses() const
Get the list of available classes (labels).
AppType
Definition: PndMvaDataSet.h:38