|
||||
File indexing completed on 2025-01-18 10:11:01
0001 // @(#)root/tmva $Id$ 0002 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss, Peter Speckmayer, Eckhard von Toerne, Jan Therhaag 0003 0004 /********************************************************************************** 0005 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis * 0006 * Package: TMVA * 0007 * Class : MethodLikelihood * 0008 * * 0009 * * 0010 * Description: * 0011 * Likelihood analysis ("non-parametric approach") * 0012 * Also implemented is a "diagonalized likelihood approach", * 0013 * which improves over the uncorrelated likelihood ansatz by transforming * 0014 * linearly the input variables into a diagonal space, using the square-root * 0015 * of the covariance matrix. This approach can be chosen by inserting * 0016 * the letter "D" into the option string. * 0017 * * 0018 * Authors (alphabetical): * 0019 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland * 0020 * Peter Speckmayer <Peter.Speckmazer@cern.ch> - CERN, Switzerland * 0021 * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland * 0022 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany * 0023 * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada * 0024 * Jan Therhaag <Jan.Therhaag@cern.ch> - U of Bonn, Germany * 0025 * Eckhard v. Toerne <evt@uni-bonn.de> - U of Bonn, Germany * 0026 * * 0027 * Copyright (c) 2005-2011: * 0028 * CERN, Switzerland * 0029 * U. of Victoria, Canada * 0030 * MPI-K Heidelberg, Germany * 0031 * U. of Bonn, Germany * 0032 * * 0033 * Redistribution and use in source and binary forms, with or without * 0034 * modification, are permitted according to the terms listed in LICENSE * 0035 * (see tmva/doc/LICENSE) * 0036 **********************************************************************************/ 0037 0038 #ifndef ROOT_TMVA_MethodLikelihood 0039 #define ROOT_TMVA_MethodLikelihood 0040 0041 ////////////////////////////////////////////////////////////////////////// 0042 // // 0043 // MethodLikelihood // 0044 // // 0045 // Likelihood analysis ("non-parametric approach") // 0046 // Also implemented is a "diagonalized likelihood approach", // 0047 // which improves over the uncorrelated likelihood ansatz by // 0048 // transforming linearly the input variables into a diagonal space, // 0049 // using the square-root of the covariance matrix // 0050 // // 0051 ////////////////////////////////////////////////////////////////////////// 0052 0053 #include "TMVA/MethodBase.h" 0054 #include "TMVA/PDF.h" 0055 #include <vector> 0056 0057 class TH1D; 0058 0059 namespace TMVA { 0060 0061 class MethodLikelihood : public MethodBase { 0062 0063 public: 0064 0065 MethodLikelihood( const TString& jobName, 0066 const TString& methodTitle, 0067 DataSetInfo& theData, 0068 const TString& theOption = ""); 0069 0070 MethodLikelihood( DataSetInfo& theData, 0071 const TString& theWeightFile); 0072 0073 virtual ~MethodLikelihood(); 0074 0075 virtual Bool_t HasAnalysisType( Types::EAnalysisType type, 0076 UInt_t numberClasses, UInt_t numberTargets ); 0077 0078 // training method 0079 void Train(); 0080 0081 // write weights to file 0082 void WriteWeightsToStream( TFile& rf ) const; 0083 void AddWeightsXMLTo( void* parent ) const; 0084 0085 // read weights from file 0086 void ReadWeightsFromStream( std::istream& istr ); 0087 void ReadWeightsFromStream( TFile& istr ); 0088 void ReadWeightsFromXML( void* wghtnode ); 0089 // calculate the MVA value 0090 // the argument is used for internal ranking tests 0091 Double_t GetMvaValue( Double_t* err = nullptr, Double_t* errUpper = nullptr ); 0092 0093 // write method specific histos to target file 0094 void WriteMonitoringHistosToFile() const; 0095 0096 // ranking of input variables 0097 const Ranking* CreateRanking(); 0098 0099 virtual void WriteOptionsToStream ( std::ostream& o, const TString& prefix ) const; 0100 0101 protected: 0102 0103 void DeclareCompatibilityOptions(); 0104 0105 // make ROOT-independent C++ class for classifier response (classifier-specific implementation) 0106 void MakeClassSpecific( std::ostream&, const TString& ) const; 0107 0108 // header and auxiliary classes 0109 void MakeClassSpecificHeader( std::ostream&, const TString& = "" ) const; 0110 0111 // get help message text 0112 void GetHelpMessage() const; 0113 0114 private: 0115 0116 // returns transformed or non-transformed output 0117 Double_t TransformLikelihoodOutput( Double_t ps, Double_t pb ) const; 0118 0119 // the option handling methods 0120 void Init(); 0121 void DeclareOptions(); 0122 void ProcessOptions(); 0123 0124 // options 0125 Double_t fEpsilon; ///< minimum number of likelihood (to avoid zero) 0126 Bool_t fTransformLikelihoodOutput; ///< likelihood output is sigmoid-transformed 0127 0128 Int_t fDropVariable; ///< for ranking test 0129 0130 std::vector<TH1*>* fHistSig; ///< signal PDFs (histograms) 0131 std::vector<TH1*>* fHistBgd; ///< background PDFs (histograms) 0132 std::vector<TH1*>* fHistSig_smooth; ///< signal PDFs (smoothed histograms) 0133 std::vector<TH1*>* fHistBgd_smooth; ///< background PDFs (smoothed histograms) 0134 0135 PDF* fDefaultPDFLik; ///< pdf that contains default definitions 0136 std::vector<PDF*>* fPDFSig; ///< list of PDFs (signal) 0137 std::vector<PDF*>* fPDFBgd; ///< list of PDFs (background) 0138 0139 // default initialisation called by all constructors 0140 0141 // obsolete variables kept for backward compatibility 0142 Int_t fNsmooth; ///< number of smooth passes 0143 Int_t* fNsmoothVarS; ///< number of smooth passes 0144 Int_t* fNsmoothVarB; ///< number of smooth passes 0145 Int_t fAverageEvtPerBin; ///< average events per bin; used to calculate fNbins 0146 Int_t* fAverageEvtPerBinVarS; ///< average events per bin; used to calculate fNbins 0147 Int_t* fAverageEvtPerBinVarB; ///< average events per bin; used to calculate fNbins 0148 TString fBorderMethodString; ///< the method to take care about "border" effects (string) 0149 Float_t fKDEfineFactor; ///< fine tuning factor for Adaptive KDE 0150 TString fKDEiterString; ///< Number of iterations (string) 0151 TString fKDEtypeString; ///< Kernel type to use for KDE (string) 0152 TString* fInterpolateString; ///< which interpolation method used for reference histograms (individual for each variable) 0153 0154 ClassDef(MethodLikelihood,0); // Likelihood analysis ("non-parametric approach") 0155 }; 0156 0157 } // namespace TMVA 0158 0159 #endif // MethodLikelihood_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |