Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:03

0001 /**********************************************************************************
0002  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
0003  * Package: TMVA                                                                  *
0004  * Class  : OptimizeConfigParameters                                              *
0005  *                                             *
0006  *                                                                                *
0007  * Description: The OptimizeConfigParameters takes care of "scanning/fitting"     *
0008  *              different tuning parameters in order to find the best set of      *
0009  *              tuning paraemters which will be used in the end                   *
0010  *                                                                                *
0011  * Authors (alphabetical):                                                        *
0012  *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
0013  *                                                                                *
0014  * Copyright (c) 2005:                                                            *
0015  *      CERN, Switzerland                                                         *
0016  *      MPI-K Heidelberg, Germany                                                 *
0017  *                                                                                *
0018  * Redistribution and use in source and binary forms, with or without             *
0019  * modification, are permitted according to the terms listed in LICENSE           *
0020  * (http://ttmva.sourceforge.net/LICENSE)                                         *
0021  **********************************************************************************/
0022 
0023 #ifndef ROOT_TMVA_OptimizeConfigParameters
0024 #define ROOT_TMVA_OptimizeConfigParameters
0025 
0026 #include "Rtypes.h"
0027 
0028 #include "TString.h"
0029 
0030 #include "TMVA/MethodBase.h"
0031 
0032 #include "TMVA/Interval.h"
0033 
0034 #include "TMVA/DataSet.h"
0035 
0036 #include "IFitterTarget.h"
0037 
0038 #include "TH1.h"
0039 
0040 #include <map>
0041 #include <vector>
0042 
0043 class TestOptimizeConfigParameters;
0044 
0045 namespace TMVA {
0046 
0047    class MethodBase;
0048    class MsgLogger;
0049    class OptimizeConfigParameters : public IFitterTarget  {
0050 
0051    public:
0052       friend TestOptimizeConfigParameters;
0053 
0054       //default constructor
0055       OptimizeConfigParameters(MethodBase * const method, std::map<TString,TMVA::Interval*> tuneParameters, TString fomType="Separation", TString optimizationType = "GA");
0056 
0057       // destructor
0058       virtual ~OptimizeConfigParameters();
0059       // could later be changed to be set via option string...
0060       // but for now it's simpler like this
0061       std::map<TString,Double_t> optimize();
0062 
0063    private:
0064       std::vector< int > GetScanIndices( int val, std::vector<int> base);
0065       void optimizeScan();
0066       void optimizeFit();
0067 
0068       Double_t EstimatorFunction( std::vector<Double_t> & );
0069 
0070       Double_t GetFOM();
0071 
0072       MethodBase* GetMethod(){return fMethod;}
0073 
0074       void GetMVADists();
0075       Double_t GetSeparation();
0076       Double_t GetROCIntegral();
0077       Double_t GetSigEffAtBkgEff( Double_t bkgEff = 0.1);
0078       Double_t GetBkgEffAtSigEff( Double_t sigEff = 0.5);
0079       Double_t GetBkgRejAtSigEff( Double_t sigEff = 0.5);
0080 
0081 
0082       MethodBase* const fMethod; ///< The MVA method to be evaluated
0083       std::vector<Float_t>             fFOMvsIter; ///< graph showing the development of the Figure Of Merit values during the fit
0084       std::map<TString,TMVA::Interval*> fTuneParameters; ///< parameters included in the tuning
0085       std::map<TString,Double_t>       fTunedParameters; ///< parameters included in the tuning
0086       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)
0087       TString           fFOMType;    ///< the FOM type (Separation, ROC integra.. whatever you implemented..
0088       TString           fOptimizationFitType; ///< which type of optimisation procedure to be used
0089       TH1D             *fMvaSig; ///< MVA distribution for signal events, used for spline fit
0090       TH1D             *fMvaBkg; ///< MVA distribution for bakgr. events, used for spline fit
0091 
0092       TH1D             *fMvaSigFineBin; ///< MVA distribution for signal events
0093       TH1D             *fMvaBkgFineBin; ///< MVA distribution for bakgr. events
0094 
0095       Bool_t           fNotDoneYet; ///<flat to indicate of Method Transformations have been obtained yet or not (normally done in MethodBase::TrainMethod)
0096 
0097       mutable MsgLogger*         fLogger;   ///<! message logger
0098       MsgLogger& Log() const { return *fLogger; }
0099 
0100       ClassDef(OptimizeConfigParameters,0); // Interface to different separation criteria used in training algorithms
0101    };
0102 } // namespace TMVA
0103 
0104 #endif