Logo ROOT   6.08/07
Reference Guide
OptimizeConfigParameters.h
Go to the documentation of this file.
1 /**********************************************************************************
2  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
3  * Package: TMVA *
4  * Class : OptimizeConfigParameters *
5  * Web : http://tmva.sourceforge.net *
6  * *
7  * Description: The OptimizeConfigParameters takes care of "scanning/fitting" *
8  * different tuning parameters in order to find the best set of *
9  * tuning paraemters which will be used in the end *
10  * *
11  * Authors (alphabetical): *
12  * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
13  * *
14  * Copyright (c) 2005: *
15  * CERN, Switzerland *
16  * MPI-K Heidelberg, Germany *
17  * *
18  * Redistribution and use in source and binary forms, with or without *
19  * modification, are permitted according to the terms listed in LICENSE *
20  * (http://ttmva.sourceforge.net/LICENSE) *
21  **********************************************************************************/
22 #include <map>
23 
24 #ifndef ROOT_TMVA_OptimizeConfigParameters
25 #define ROOT_TMVA_OptimizeConfigParameters
26 
27 
28 #ifndef ROOT_Rtypes
29 #include "Rtypes.h"
30 #endif
31 
32 #ifndef ROOT_TString
33 #include "TString.h"
34 #endif
35 
36 #ifndef ROOT_TMVA_MethodBase
37 #include "TMVA/MethodBase.h"
38 #endif
39 
40 
41 #ifndef ROOT_TMVA_Interval
42 #include "TMVA/Interval.h"
43 #endif
44 
45 #ifndef ROOT_TMVA_DataSet
46 #include "TMVA/DataSet.h"
47 #endif
48 
49 #ifndef ROOT_TMVA_IFitterTarget
50 #ifndef ROOT_IFitterTarget
51 #include "IFitterTarget.h"
52 #endif
53 #endif
54 
55 #ifndef ROOT_TH1
56 #include "TH1.h"
57 #endif
58 
59 namespace TMVA {
60 
61  class MethodBase;
62  class MsgLogger;
64 
65  public:
66 
67  //default constructor
68  OptimizeConfigParameters(MethodBase * const method, std::map<TString,TMVA::Interval*> tuneParameters, TString fomType="Separation", TString optimizationType = "GA");
69 
70  // destructor
71  virtual ~OptimizeConfigParameters();
72  // could later be changed to be set via option string...
73  // but for now it's impler like this
74  std::map<TString,Double_t> optimize();
75 
76  private:
77  std::vector< int > GetScanIndices( int val, std::vector<int> base);
78  void optimizeScan();
79  void optimizeFit();
80 
81  Double_t EstimatorFunction( std::vector<Double_t> & );
82 
83  Double_t GetFOM();
84 
86 
87  void GetMVADists();
90  Double_t GetSigEffAtBkgEff( Double_t bkgEff = 0.1);
91  Double_t GetBkgEffAtSigEff( Double_t sigEff = 0.5);
92  Double_t GetBkgRejAtSigEff( Double_t sigEff = 0.5);
93 
94 
95  MethodBase* const fMethod; // The MVA method to be evaluated
96  std::vector<Float_t> fFOMvsIter; // graph showing the develompment of the Figure Of Merit values during the fit
97  std::map<TString,TMVA::Interval*> fTuneParameters; // parameters included in the tuning
98  std::map<TString,Double_t> fTunedParameters; // parameters included in the tuning
99  std::map< std::vector<Double_t> , Double_t> fAlreadyTrainedParCombination; // save parameters for which the FOM is already known (GA seems to evaluate the same parameters several times)
100  TString fFOMType; // the FOM type (Separation, ROC integra.. whaeter you implemented..
101  TString fOptimizationFitType; // which type of optimisation procedure to be used
102  TH1D *fMvaSig; // MVA distrituion for signal events, used for spline fit
103  TH1D *fMvaBkg; // MVA distrituion for bakgr. events, used for spline fit
104 
105  TH1D *fMvaSigFineBin; // MVA distrituion for signal events
106  TH1D *fMvaBkgFineBin; // MVA distrituion for bakgr. events
107 
108  Bool_t fNotDoneYet; // flat to indicate of Method Transformations have been optained yet or not (normally done in MethodBase::TrainMethod)
109 
110  mutable MsgLogger* fLogger; // message logger
111  MsgLogger& Log() const { return *fLogger; }
112 
113  ClassDef(OptimizeConfigParameters,0); // Interface to different separation critiera used in training algorithms
114  };
115 } // namespace TMVA
116 
117 #endif
std::map< TString, Double_t > fTunedParameters
std::map< TString, TMVA::Interval * > fTuneParameters
Basic string class.
Definition: TString.h:137
Double_t GetSeparation()
return the searation between the signal and background MVA ouput distribution
void optimizeScan()
do the actual optimization using a simple scan method, i.e.
bool Bool_t
Definition: RtypesCore.h:59
Double_t GetFOM()
Return the Figure of Merit (FOM) used in the parameter optimization process.
void GetMVADists()
fill the private histograms with the mva distributinos for sig/bkg
#define ClassDef(name, id)
Definition: Rtypes.h:254
Double_t GetROCIntegral()
calculate the area (integral) under the ROC curve as a overall quality measure of the classification ...
std::map< TString, Double_t > optimize()
virtual ~OptimizeConfigParameters()
the destructor (delete the OptimizeConfigParameters, store the graph and .. delete it) ...
Double_t GetSigEffAtBkgEff(Double_t bkgEff=0.1)
calculate the signal efficiency for a given background efficiency
tomato 1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:618
double Double_t
Definition: RtypesCore.h:55
Double_t GetBkgEffAtSigEff(Double_t sigEff=0.5)
calculate the background efficiency for a given signal efficiency
Abstract ClassifierFactory template that handles arbitrary types.
std::vector< int > GetScanIndices(int val, std::vector< int > base)
helper function to scan through the all the combinations in the parameter space
Double_t GetBkgRejAtSigEff(Double_t sigEff=0.5)
calculate the background rejection for a given signal efficiency
Double_t EstimatorFunction(std::vector< Double_t > &)
return the estimator (from current FOM) for the fitting interface
std::map< std::vector< Double_t >, Double_t > fAlreadyTrainedParCombination
OptimizeConfigParameters(MethodBase *const method, std::map< TString, TMVA::Interval *> tuneParameters, TString fomType="Separation", TString optimizationType="GA")
Constructor which sets either "Classification or Regression".