00001 /********************************************************************************** 00002 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis * 00003 * Package: TMVA * 00004 * Class : OptimizeConfigParameters * 00005 * Web : http://tmva.sourceforge.net * 00006 * * 00007 * Description: The OptimizeConfigParameters takes care of "scanning/fitting" * 00008 * different tuning parameters in order to find the best set of * 00009 * tuning paraemters which will be used in the end * 00010 * * 00011 * Authors (alphabetical): * 00012 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany * 00013 * * 00014 * Copyright (c) 2005: * 00015 * CERN, Switzerland * 00016 * MPI-K Heidelberg, Germany * 00017 * * 00018 * Redistribution and use in source and binary forms, with or without * 00019 * modification, are permitted according to the terms listed in LICENSE * 00020 * (http://ttmva.sourceforge.net/LICENSE) * 00021 **********************************************************************************/ 00022 #include <map> 00023 00024 #ifndef ROOT_TMVA_OptimizeConfigParameters 00025 #define ROOT_TMVA_OptimizeConfigParameters 00026 00027 00028 #ifndef ROOT_Rtypes 00029 #include "Rtypes.h" 00030 #endif 00031 00032 #ifndef ROOT_TString 00033 #include "TString.h" 00034 #endif 00035 00036 #ifndef ROOT_TMVA_MethodBase 00037 #include "TMVA/MethodBase.h" 00038 #endif 00039 00040 00041 #ifndef ROOT_TMVA_Interval 00042 #include "TMVA/Interval.h" 00043 #endif 00044 00045 #ifndef ROOT_TMVA_DataSet 00046 #include "TMVA/DataSet.h" 00047 #endif 00048 00049 #ifndef ROOT_TMVA_IFitterTarget 00050 #ifndef ROOT_IFitterTarget 00051 #include "IFitterTarget.h" 00052 #endif 00053 #endif 00054 00055 #ifndef ROOT_TH1 00056 #include "TH1.h" 00057 #endif 00058 00059 namespace TMVA { 00060 00061 class MethodBase; 00062 class MsgLogger; 00063 class OptimizeConfigParameters : public IFitterTarget { 00064 00065 public: 00066 00067 //default constructor 00068 OptimizeConfigParameters(MethodBase * const method, std::map<TString,TMVA::Interval> tuneParameters, TString fomType="Separation", TString optimizationType = "GA"); 00069 00070 // destructor 00071 virtual ~OptimizeConfigParameters(); 00072 // could later be changed to be set via option string... 00073 // but for now it's impler like this 00074 std::map<TString,Double_t> optimize(); 00075 00076 private: 00077 void optimizeScan(); 00078 void optimizeFit(); 00079 00080 Double_t EstimatorFunction( std::vector<Double_t> & ); 00081 00082 Double_t GetFOM(); 00083 00084 MethodBase* GetMethod(){return fMethod;} 00085 00086 void GetMVADists(); 00087 Double_t GetSeparation(); 00088 Double_t GetROCIntegral(); 00089 Double_t GetSigEffAt( Double_t bkgEff = 0.1); 00090 00091 00092 MethodBase* const fMethod; // The MVA method to be evaluated 00093 std::vector<Float_t> fFOMvsIter; // graph showing the develompment of the Figure Of Merit values during the fit 00094 std::map<TString,TMVA::Interval> fTuneParameters; // parameters included in the tuning 00095 std::map<TString,Double_t> fTunedParameters; // parameters included in the tuning 00096 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) 00097 TString fFOMType; // the FOM type (Separation, ROC integra.. whaeter you implemented.. 00098 TString fOptimizationFitType; // which type of optimisation procedure to be used 00099 TH1D *fMvaSig; // MVA distrituion for signal events, used for spline fit 00100 TH1D *fMvaBkg; // MVA distrituion for bakgr. events, used for spline fit 00101 00102 TH1D *fMvaSigFineBin; // MVA distrituion for signal events 00103 TH1D *fMvaBkgFineBin; // MVA distrituion for bakgr. events 00104 00105 00106 mutable MsgLogger* fLogger; // message logger 00107 MsgLogger& Log() const { return *fLogger; } 00108 00109 ClassDef(OptimizeConfigParameters,0) // Interface to different separation critiera used in training algorithms 00110 }; 00111 } // namespace TMVA 00112 00113 #endif