File indexing completed on 2025-01-18 10:11:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #ifndef ROOT_TMVA_MethodBoost
0033 #define ROOT_TMVA_MethodBoost
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 #include <iosfwd>
0044 #include <vector>
0045
0046 #include "TMVA/MethodBase.h"
0047
0048 #include "TMVA/MethodCompositeBase.h"
0049
0050 namespace TMVA {
0051
0052 class Factory;
0053 class Reader;
0054 class DataSetManager;
0055 namespace Experimental {
0056 class Classification;
0057 }
0058 class MethodBoost : public MethodCompositeBase {
0059 friend class Factory;
0060 friend class Reader;
0061 friend class Experimental::Classification;
0062
0063 public :
0064
0065
0066 MethodBoost( const TString& jobName,
0067 const TString& methodTitle,
0068 DataSetInfo& theData,
0069 const TString& theOption = "" );
0070
0071 MethodBoost( DataSetInfo& dsi,
0072 const TString& theWeightFile );
0073
0074 virtual ~MethodBoost( void );
0075
0076 virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t );
0077
0078
0079 void Train( void );
0080
0081
0082 const Ranking* CreateRanking();
0083
0084
0085 Bool_t BookMethod( Types::EMVA theMethod, TString methodTitle, TString theOption );
0086 void SetBoostedMethodName ( TString methodName ) { fBoostedMethodName = methodName; }
0087
0088 Int_t GetBoostNum() { return fBoostNum; }
0089
0090 void CleanBoostOptions();
0091
0092 Double_t GetMvaValue( Double_t* err = nullptr, Double_t* errUpper = nullptr );
0093
0094 private :
0095
0096 void ClearAll();
0097
0098
0099 void PrintResults( const TString&, std::vector<Double_t>&, const Double_t ) const;
0100
0101
0102 void Init();
0103 void InitHistos();
0104 void CheckSetup();
0105
0106 void MonitorBoost( Types::EBoostStage stage, UInt_t methodIdx=0);
0107
0108
0109 void DeclareOptions();
0110 void DeclareCompatibilityOptions();
0111 void ProcessOptions();
0112
0113
0114 MethodBase* CurrentMethod(){return fCurrentMethod;}
0115 UInt_t CurrentMethodIdx(){return fCurrentMethodIdx;}
0116
0117 void SingleTrain();
0118
0119
0120 Double_t SingleBoost(MethodBase* method);
0121 Double_t AdaBoost(MethodBase* method, Bool_t useYesNoLeaf );
0122 Double_t Bagging();
0123
0124
0125
0126 Double_t CalcMethodWeight();
0127
0128
0129 Double_t GetBoostROCIntegral(Bool_t, Types::ETreeType, Bool_t CalcOverlapIntergral=kFALSE);
0130
0131
0132 void WriteMonitoringHistosToFile( void ) const;
0133
0134
0135 virtual void WriteEvaluationHistosToFile(Types::ETreeType treetype);
0136
0137
0138 virtual void TestClassification();
0139
0140
0141 void FindMVACut(MethodBase* method);
0142
0143
0144 void ResetBoostWeights();
0145
0146
0147 void CreateMVAHistorgrams();
0148
0149
0150
0151 void CalcMVAValues();
0152
0153 UInt_t fBoostNum;
0154 TString fBoostType;
0155
0156 TString fTransformString;
0157 Bool_t fDetailedMonitoring;
0158
0159 Double_t fAdaBoostBeta;
0160 UInt_t fRandomSeed;
0161 Double_t fBaggedSampleFraction;
0162
0163 TString fBoostedMethodName;
0164 TString fBoostedMethodTitle;
0165 TString fBoostedMethodOptions;
0166
0167 Bool_t fMonitorBoostedMethod;
0168
0169
0170 std::vector< TH1* > fTrainSigMVAHist;
0171 std::vector< TH1* > fTrainBgdMVAHist;
0172
0173 std::vector< TH1* > fBTrainSigMVAHist;
0174 std::vector< TH1* > fBTrainBgdMVAHist;
0175
0176 std::vector< TH1* > fTestSigMVAHist;
0177 std::vector
0178 < TH1* > fTestBgdMVAHist;
0179
0180
0181 TTree* fMonitorTree;
0182 Double_t fBoostWeight;
0183 Double_t fMethodError;
0184
0185 Double_t fROC_training;
0186
0187
0188
0189 Double_t fOverlap_integral;
0190
0191 std::vector<Float_t> *fMVAvalues;
0192
0193 DataSetManager* fDataSetManager;
0194 TString fHistoricOption;
0195 Bool_t fHistoricBoolOption;
0196
0197 protected:
0198
0199
0200 void GetHelpMessage() const;
0201
0202 ClassDef(MethodBoost,0);
0203 };
0204 }
0205
0206 #endif