File indexing completed on 2026-06-13 08:36:37
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 #ifndef ROOT_TMVA_MethodDT
0028 #define ROOT_TMVA_MethodDT
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 #include <vector>
0039 #include "TH1.h"
0040 #include "TH2.h"
0041 #include "TTree.h"
0042 #include "TMVA/MethodBase.h"
0043 #include "TMVA/DecisionTree.h"
0044 #include "TMVA/Event.h"
0045
0046 namespace TMVA {
0047 class MethodBoost;
0048
0049 class MethodDT : public MethodBase {
0050 public:
0051 MethodDT( const TString& jobName,
0052 const TString& methodTitle,
0053 DataSetInfo& theData,
0054 const TString& theOption = "");
0055
0056 MethodDT( DataSetInfo& dsi,
0057 const TString& theWeightFile);
0058
0059 virtual ~MethodDT( void );
0060
0061 Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets ) override;
0062
0063 void Train( void ) override;
0064
0065 using MethodBase::ReadWeightsFromStream;
0066
0067
0068 void AddWeightsXMLTo( void* parent ) const override;
0069
0070
0071 void ReadWeightsFromStream( std::istream& istr ) override;
0072 void ReadWeightsFromXML ( void* wghtnode ) override;
0073
0074
0075 Double_t GetMvaValue( Double_t* err = nullptr, Double_t* errUpper = nullptr ) override;
0076
0077
0078 void DeclareOptions() override;
0079 void ProcessOptions() override;
0080 void DeclareCompatibilityOptions() override;
0081
0082 void GetHelpMessage() const override;
0083
0084
0085 const Ranking* CreateRanking() override;
0086
0087 Double_t PruneTree( );
0088
0089 Double_t TestTreeQuality( DecisionTree *dt );
0090
0091 Double_t GetPruneStrength () { return fPruneStrength; }
0092
0093 void SetMinNodeSize(Double_t sizeInPercent);
0094 void SetMinNodeSize(TString sizeInPercent);
0095
0096 Int_t GetNNodesBeforePruning(){return fTree->GetNNodesBeforePruning();}
0097 Int_t GetNNodes(){return fTree->GetNNodes();}
0098
0099 private:
0100
0101 void Init( void ) override;
0102
0103 private:
0104
0105
0106 std::vector<Event*> fEventSample;
0107
0108 DecisionTree* fTree;
0109
0110 SeparationBase *fSepType;
0111 TString fSepTypeS;
0112 Int_t fMinNodeEvents;
0113 Float_t fMinNodeSize;
0114 TString fMinNodeSizeS;
0115
0116 Int_t fNCuts;
0117 Bool_t fUseYesNoLeaf;
0118 Double_t fNodePurityLimit;
0119 UInt_t fMaxDepth;
0120
0121
0122 Double_t fErrorFraction;
0123 Double_t fPruneStrength;
0124 DecisionTree::EPruneMethod fPruneMethod;
0125 TString fPruneMethodS;
0126 Bool_t fAutomatic;
0127 Bool_t fRandomisedTrees;
0128 Int_t fUseNvars;
0129 Bool_t fUsePoissonNvars;
0130 std::vector<Double_t> fVariableImportance;
0131
0132 Double_t fDeltaPruneStrength;
0133
0134 static const Int_t fgDebugLevel = 0;
0135
0136
0137 Bool_t fPruneBeforeBoost;
0138
0139 ClassDefOverride(MethodDT,0);
0140
0141 };
0142 }
0143
0144 #endif