Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
HyperParameterOptimisation.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Omar Zapata, Thomas James Stevenson.
3 
4 
5 #ifndef ROOT_TMVA_HyperParameterOptimisation
6 #define ROOT_TMVA_HyperParameterOptimisation
7 
8 
9 #include "TString.h"
10 
11 #include "TMultiGraph.h"
12 
13 #include "TMVA/IMethod.h"
14 #include "TMVA/Configurable.h"
15 #include "TMVA/Types.h"
16 #include "TMVA/DataSet.h"
17 #include "TMVA/Event.h"
18 #include <TMVA/Results.h>
19 
20 #include <TMVA/Factory.h>
21 
22 #include <TMVA/DataLoader.h>
23 
24 #include <TMVA/Envelope.h>
25 
26 namespace TMVA {
27 
28  class HyperParameterOptimisationResult
29  {
30  friend class HyperParameterOptimisation;
31  private:
32  Float_t fROCAVG;
33  std::vector<Float_t> fROCs;
34  std::vector<Double_t> fSigs;
35  std::vector<Double_t> fSeps;
36  std::vector<Double_t> fEff01s;
37  std::vector<Double_t> fEff10s;
38  std::vector<Double_t> fEff30s;
39  std::vector<Double_t> fEffAreas;
40  std::vector<Double_t> fTrainEff01s;
41  std::vector<Double_t> fTrainEff10s;
42  std::vector<Double_t> fTrainEff30s;
43  std::shared_ptr<TMultiGraph> fROCCurves;
44  TString fMethodName;
45 
46  public:
47  HyperParameterOptimisationResult();
48  ~HyperParameterOptimisationResult();
49 
50  std::vector<std::map<TString,Double_t> > fFoldParameters;
51 
52  std::vector<Float_t> GetROCValues(){return fROCs;}
53  Float_t GetROCAverage(){return fROCAVG;}
54  TMultiGraph *GetROCCurves(Bool_t fLegend=kTRUE);
55 
56  void Print() const ;
57 // TCanvas* Draw(const TString name="HyperParameterOptimisation") const;
58 
59  std::vector<Double_t> GetSigValues(){return fSigs;}
60  std::vector<Double_t> GetSepValues(){return fSeps;}
61  std::vector<Double_t> GetEff01Values(){return fEff01s;}
62  std::vector<Double_t> GetEff10Values(){return fEff10s;}
63  std::vector<Double_t> GetEff30Values(){return fEff30s;}
64  std::vector<Double_t> GetEffAreaValues(){return fEffAreas;}
65  std::vector<Double_t> GetTrainEff01Values(){return fTrainEff01s;}
66  std::vector<Double_t> GetTrainEff10Values(){return fTrainEff10s;}
67  std::vector<Double_t> GetTrainEff30Values(){return fTrainEff30s;}
68 
69  };
70 
71  class HyperParameterOptimisation : public Envelope {
72  public:
73 
74  HyperParameterOptimisation(DataLoader *dataloader);
75  ~HyperParameterOptimisation();
76 
77  void SetFitter(TString fitType){fFitType=fitType;}
78  TString GetFiiter(){return fFitType;}
79 
80 
81  //Figure of Merit (FOM) default Separation
82  void SetFOMType(TString ftype){fFomType=ftype;}
83  TString GetFOMType(){return fFitType;}
84 
85  void SetNumFolds(UInt_t folds);
86  UInt_t GetNumFolds(){return fNumFolds;}
87 
88  virtual void Evaluate();
89  const HyperParameterOptimisationResult& GetResults() const {return fResults;}
90 
91 
92  private:
93  TString fFomType; //!
94  TString fFitType; //!
95  UInt_t fNumFolds; //!
96  Bool_t fFoldStatus; //!
97  HyperParameterOptimisationResult fResults; //!
98  std::unique_ptr<Factory> fClassifier; //!
99 
100  public:
101  ClassDef(HyperParameterOptimisation,0);
102  };
103 }
104 
105 
106 #endif
107 
108 
109