Logo ROOT   6.14/05
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 #include "Rtypes.h"
29 
30 #include "TString.h"
31 
32 #include "TMVA/MethodBase.h"
33 
34 
35 #include "TMVA/Interval.h"
36 
37 #include "TMVA/DataSet.h"
38 
39 #include "IFitterTarget.h"
40 
41 #include "TH1.h"
42 
43 namespace TMVA {
44 
45  class MethodBase;
46  class MsgLogger;
48 
49  public:
50 
51  //default constructor
52  OptimizeConfigParameters(MethodBase * const method, std::map<TString,TMVA::Interval*> tuneParameters, TString fomType="Separation", TString optimizationType = "GA");
53 
54  // destructor
55  virtual ~OptimizeConfigParameters();
56  // could later be changed to be set via option string...
57  // but for now it's simpler like this
58  std::map<TString,Double_t> optimize();
59 
60  private:
61  std::vector< int > GetScanIndices( int val, std::vector<int> base);
62  void optimizeScan();
63  void optimizeFit();
64 
65  Double_t EstimatorFunction( std::vector<Double_t> & );
66 
67  Double_t GetFOM();
68 
70 
71  void GetMVADists();
74  Double_t GetSigEffAtBkgEff( Double_t bkgEff = 0.1);
75  Double_t GetBkgEffAtSigEff( Double_t sigEff = 0.5);
76  Double_t GetBkgRejAtSigEff( Double_t sigEff = 0.5);
77 
78 
79  MethodBase* const fMethod; // The MVA method to be evaluated
80  std::vector<Float_t> fFOMvsIter; // graph showing the development of the Figure Of Merit values during the fit
81  std::map<TString,TMVA::Interval*> fTuneParameters; // parameters included in the tuning
82  std::map<TString,Double_t> fTunedParameters; // parameters included in the tuning
83  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)
84  TString fFOMType; // the FOM type (Separation, ROC integra.. whatever you implemented..
85  TString fOptimizationFitType; // which type of optimisation procedure to be used
86  TH1D *fMvaSig; // MVA distribution for signal events, used for spline fit
87  TH1D *fMvaBkg; // MVA distribution for bakgr. events, used for spline fit
88 
89  TH1D *fMvaSigFineBin; // MVA distribution for signal events
90  TH1D *fMvaBkgFineBin; // MVA distribution for bakgr. events
91 
92  Bool_t fNotDoneYet; // flat to indicate of Method Transformations have been obtained yet or not (normally done in MethodBase::TrainMethod)
93 
94  mutable MsgLogger* fLogger; // message logger
95  MsgLogger& Log() const { return *fLogger; }
96 
97  ClassDef(OptimizeConfigParameters,0); // Interface to different separation criteria used in training algorithms
98  };
99 } // namespace TMVA
100 
101 #endif
std::map< TString, Double_t > fTunedParameters
std::map< TString, TMVA::Interval * > fTuneParameters
Virtual base Class for all MVA method.
Definition: MethodBase.h:109
Basic string class.
Definition: TString.h:131
Double_t GetSeparation()
return the separation 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 distributions for sig/bkg
#define ClassDef(name, id)
Definition: Rtypes.h:320
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
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:610
double Double_t
Definition: RtypesCore.h:55
Double_t GetBkgEffAtSigEff(Double_t sigEff=0.5)
calculate the background efficiency for a given signal efficiency
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:59
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
Interface for a fitter &#39;target&#39;.
Definition: IFitterTarget.h:44
OptimizeConfigParameters(MethodBase *const method, std::map< TString, TMVA::Interval *> tuneParameters, TString fomType="Separation", TString optimizationType="GA")
Constructor which sets either "Classification or Regression".