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 #ifndef ROOT_TMVA_MethodCommittee
00030 #define ROOT_TMVA_MethodCommittee
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #include <vector>
00041 #include <iosfwd>
00042 #ifndef ROOT_TH2
00043 #include "TH2.h"
00044 #endif
00045 #ifndef ROOT_TTree
00046 #include "TTree.h"
00047 #endif
00048
00049 #ifndef ROOT_TMVA_MethodBase
00050 #include "TMVA/MethodBase.h"
00051 #endif
00052
00053 namespace TMVA {
00054
00055 class MethodCommittee : public MethodBase {
00056
00057 public:
00058
00059
00060 MethodCommittee( const TString& jobName,
00061 const TString& methodTitle,
00062 DataSetInfo& dsi,
00063 const TString& theOption,
00064 TDirectory* theTargetDir = 0 );
00065
00066
00067 MethodCommittee( DataSetInfo& theData,
00068 const TString& theWeightFile,
00069 TDirectory* theTargetDir = 0 );
00070
00071 virtual ~MethodCommittee( void );
00072
00073 virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets );
00074
00075
00076 void WriteStateToFile() const;
00077
00078
00079 void Train();
00080
00081 using MethodBase::ReadWeightsFromStream;
00082
00083
00084 void AddWeightsXMLTo( void* parent ) const;
00085
00086
00087 void ReadWeightsFromStream( istream& istr );
00088 void ReadWeightsFromXML ( void* ) {}
00089
00090
00091 void WriteMonitoringHistosToFile( void ) const;
00092
00093
00094 Double_t GetMvaValue( Double_t* err = 0, Double_t* errUpper = 0 );
00095
00096
00097 Double_t Boost( TMVA::MethodBase*, UInt_t imember );
00098
00099
00100 const Ranking* CreateRanking();
00101
00102
00103 void DeclareOptions();
00104 void ProcessOptions();
00105
00106
00107 const std::vector<TMVA::IMethod*>& GetCommittee() const { return fCommittee; }
00108 const std::vector<Double_t>& GetBoostWeights() const { return fBoostWeights; }
00109
00110
00111 std::vector<Double_t> GetVariableImportance();
00112 Double_t GetVariableImportance( UInt_t ivar );
00113
00114 protected:
00115
00116
00117 void MakeClassSpecific( std::ostream&, const TString& ) const;
00118
00119
00120 void GetHelpMessage() const;
00121
00122 private:
00123
00124
00125 std::vector<IMethod*>& GetCommittee() { return fCommittee; }
00126 std::vector<Double_t>& GetBoostWeights() { return fBoostWeights; }
00127
00128
00129 Double_t AdaBoost( MethodBase* );
00130
00131
00132 Double_t Bagging( UInt_t imember);
00133
00134 UInt_t fNMembers;
00135 std::vector<IMethod*> fCommittee;
00136 std::vector<Double_t> fBoostWeights;
00137 TString fBoostType;
00138
00139
00140 Types::EMVA fMemberType;
00141 TString fMemberOption;
00142
00143 Bool_t fUseMemberDecision;
00144
00145
00146 Bool_t fUseWeightedMembers;
00147
00148
00149
00150 void Init( void );
00151
00152
00153 TH1F* fBoostFactorHist;
00154 TH2F* fErrFractHist;
00155 TTree* fMonitorNtuple;
00156 Int_t fITree ;
00157 Double_t fBoostFactor;
00158 Double_t fErrorFraction;
00159 Int_t fNnodes;
00160
00161 std::vector< Double_t > fVariableImportance;
00162
00163 ClassDef(MethodCommittee,0)
00164 };
00165
00166 }
00167
00168 #endif