Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 class TestOptimizeConfigParameters;
44 
45 namespace TMVA {
46 
47  class MethodBase;
48  class MsgLogger;
49  class OptimizeConfigParameters : public IFitterTarget {
50 
51  public:
52  friend TestOptimizeConfigParameters;
53 
54  //default constructor
55  OptimizeConfigParameters(MethodBase * const method, std::map<TString,TMVA::Interval*> tuneParameters, TString fomType="Separation", TString optimizationType = "GA");
56 
57  // destructor
58  virtual ~OptimizeConfigParameters();
59  // could later be changed to be set via option string...
60  // but for now it's simpler like this
61  std::map<TString,Double_t> optimize();
62 
63  private:
64  std::vector< int > GetScanIndices( int val, std::vector<int> base);
65  void optimizeScan();
66  void optimizeFit();
67 
68  Double_t EstimatorFunction( std::vector<Double_t> & );
69 
70  Double_t GetFOM();
71 
72  MethodBase* GetMethod(){return fMethod;}
73 
74  void GetMVADists();
75  Double_t GetSeparation();
76  Double_t GetROCIntegral();
77  Double_t GetSigEffAtBkgEff( Double_t bkgEff = 0.1);
78  Double_t GetBkgEffAtSigEff( Double_t sigEff = 0.5);
79  Double_t GetBkgRejAtSigEff( Double_t sigEff = 0.5);
80 
81 
82  MethodBase* const fMethod; // The MVA method to be evaluated
83  std::vector<Float_t> fFOMvsIter; // graph showing the development of the Figure Of Merit values during the fit
84  std::map<TString,TMVA::Interval*> fTuneParameters; // parameters included in the tuning
85  std::map<TString,Double_t> fTunedParameters; // parameters included in the tuning
86  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)
87  TString fFOMType; // the FOM type (Separation, ROC integra.. whatever you implemented..
88  TString fOptimizationFitType; // which type of optimisation procedure to be used
89  TH1D *fMvaSig; // MVA distribution for signal events, used for spline fit
90  TH1D *fMvaBkg; // MVA distribution for bakgr. events, used for spline fit
91 
92  TH1D *fMvaSigFineBin; // MVA distribution for signal events
93  TH1D *fMvaBkgFineBin; // MVA distribution for bakgr. events
94 
95  Bool_t fNotDoneYet; // flat to indicate of Method Transformations have been obtained yet or not (normally done in MethodBase::TrainMethod)
96 
97  mutable MsgLogger* fLogger; // message logger
98  MsgLogger& Log() const { return *fLogger; }
99 
100  ClassDef(OptimizeConfigParameters,0); // Interface to different separation criteria used in training algorithms
101  };
102 } // namespace TMVA
103 
104 #endif