00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef ROOT_TMVA_MethodBoost
00033 #define ROOT_TMVA_MethodBoost
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include <iosfwd>
00044 #include <vector>
00045
00046 #ifndef ROOT_TMVA_MethodBase
00047 #include "TMVA/MethodBase.h"
00048 #endif
00049
00050 #ifndef ROOT_TMVA_MethodCompositeBase
00051 #include "TMVA/MethodCompositeBase.h"
00052 #endif
00053
00054 namespace TMVA {
00055
00056 class Factory;
00057 class Reader;
00058 class DataSetManager;
00059
00060 class MethodBoost : public MethodCompositeBase {
00061
00062 public :
00063
00064
00065 MethodBoost( const TString& jobName,
00066 const TString& methodTitle,
00067 DataSetInfo& theData,
00068 const TString& theOption = "",
00069 TDirectory* theTargetDir = NULL );
00070
00071 MethodBoost( DataSetInfo& dsi,
00072 const TString& theWeightFile,
00073 TDirectory* theTargetDir = NULL );
00074
00075 virtual ~MethodBoost( void );
00076
00077 virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t );
00078
00079
00080 void Train( void );
00081
00082
00083 const Ranking* CreateRanking();
00084
00085
00086 Bool_t BookMethod( Types::EMVA theMethod, TString methodTitle, TString theOption );
00087 void SetBoostedMethodName ( TString methodName ) { fBoostedMethodName = methodName; }
00088
00089 Int_t GetBoostNum() { return fBoostNum; }
00090
00091
00092
00093 TH1* GetMonitoringHist( Int_t histInd ) { return (*fMonitorHist)[fDefaultHistNum+histInd]; }
00094
00095 void AddMonitoringHist( TH1* hist ) { return fMonitorHist->push_back(hist); }
00096
00097 Types::EBoostStage GetBoostStage() { return fBoostStage; }
00098
00099 void CleanBoostOptions();
00100
00101 Double_t GetMvaValue( Double_t* err=0, Double_t* errUpper = 0 );
00102
00103 private :
00104
00105 void ClearAll();
00106
00107
00108 void PrintResults( const TString&, std::vector<Double_t>&, const Double_t ) const;
00109
00110
00111 void Init();
00112 void InitHistos();
00113 void CheckSetup();
00114
00115
00116 void DeclareOptions();
00117 void ProcessOptions();
00118
00119 MethodBoost* SetStage( Types::EBoostStage stage ) { fBoostStage = stage; return this; }
00120
00121
00122 void SingleTrain();
00123
00124
00125 void SingleBoost();
00126
00127
00128 void CalcMethodWeight();
00129
00130
00131 Double_t GetBoostROCIntegral(Bool_t, Types::ETreeType, Bool_t CalcOverlapIntergral=kFALSE);
00132
00133
00134 void WriteMonitoringHistosToFile( void ) const;
00135
00136
00137 virtual void WriteEvaluationHistosToFile(Types::ETreeType treetype);
00138
00139
00140 virtual void TestClassification();
00141
00142
00143 void FindMVACut();
00144
00145
00146 void ResetBoostWeights();
00147
00148
00149 void CreateMVAHistorgrams();
00150
00151
00152
00153 void CalcMVAValues();
00154
00155
00156 Int_t fBoostNum;
00157
00158 TString fBoostType;
00159
00160
00161 TString fMethodWeightType;
00162
00163
00164 Double_t fMethodError;
00165
00166 Double_t fOrigMethodError;
00167
00168
00169 Double_t fBoostWeight;
00170
00171
00172 TString fTransformString;
00173
00174
00175 Double_t fADABoostBeta;
00176
00177
00178 UInt_t fRandomSeed;
00179
00180
00181 TString fBoostedMethodName;
00182 TString fBoostedMethodTitle;
00183 TString fBoostedMethodOptions;
00184
00185
00186 std::vector<TH1*>* fMonitorHist;
00187
00188
00189 Bool_t fMonitorBoostedMethod;
00190
00191
00192 std::vector< TH1* > fTrainSigMVAHist;
00193 std::vector< TH1* > fTrainBgdMVAHist;
00194
00195 std::vector< TH1* > fBTrainSigMVAHist;
00196 std::vector< TH1* > fBTrainBgdMVAHist;
00197
00198 std::vector< TH1* > fTestSigMVAHist;
00199 std::vector< TH1* > fTestBgdMVAHist;
00200
00201
00202 TTree* fMonitorTree;
00203
00204
00205 Types::EBoostStage fBoostStage;
00206
00207
00208 Int_t fDefaultHistNum;
00209
00210
00211 Bool_t fRecalculateMVACut;
00212
00213
00214 Double_t fROC_training;
00215
00216
00217
00218 Double_t fOverlap_integral;
00219
00220
00221 std::vector<Float_t> *fMVAvalues;
00222
00223 DataSetManager* fDataSetManager;
00224 friend class Factory;
00225 friend class Reader;
00226
00227
00228
00229
00230
00231 protected:
00232
00233
00234 void GetHelpMessage() const;
00235
00236 ClassDef(MethodBoost,0)
00237 };
00238 }
00239
00240 #endif