Logo ROOT  
Reference Guide
TMVA::RuleFit Class Reference

A class implementing various fits of rule ensembles.

Definition at line 46 of file RuleFit.h.

Public Member Functions

 RuleFit (const TMVA::MethodBase *rfbase)
 constructor More...
 
 RuleFit (void)
 default constructor More...
 
virtual ~RuleFit (void)
 destructor More...
 
void Boost (TMVA::DecisionTree *dt)
 Boost the events. More...
 
void BuildTree (TMVA::DecisionTree *dt)
 build the decision tree using fNTreeSample events from fTrainingEventsRndm More...
 
void CalcImportance ()
 calculates the importance of each rule More...
 
Double_t CalcWeightSum (const std::vector< const TMVA::Event * > *events, UInt_t neve=0)
 calculate the sum of weights More...
 
Double_t EvalEvent (const Event &e)
 evaluate single event More...
 
void FillCorr (TH2F *h2, const TMVA::Rule *rule, Int_t v1, Int_t v2)
 fill rule correlation between vx and vy, weighted with either the importance or the coefficient More...
 
void FillCut (TH2F *h2, const TMVA::Rule *rule, Int_t vind)
 Fill cut. More...
 
void FillLin (TH2F *h2, Int_t vind)
 fill lin More...
 
void FillVisHistCorr (const Rule *rule, std::vector< TH2F * > &hlist)
 help routine to MakeVisHists() - fills for all correlation plots More...
 
void FillVisHistCut (const Rule *rule, std::vector< TH2F * > &hlist)
 help routine to MakeVisHists() - fills for all variables More...
 
void FitCoefficients ()
 Fit the coefficients for the rule ensemble. More...
 
void ForestStatistics ()
 summary of statistics of all trees More...
 
Bool_t GetCorrVars (TString &title, TString &var1, TString &var2)
 get first and second variables from title More...
 
const std::vector< const TMVA::DecisionTree * > & GetForest () const
 
const MethodBaseGetMethodBase () const
 
const MethodRuleFitGetMethodRuleFit () const
 
Double_t GetNEveEff () const
 
UInt_t GetNTreeSample () const
 
void GetRndmSampleEvents (std::vector< const TMVA::Event * > &evevec, UInt_t nevents)
 draw a random subsample of the training events without replacement More...
 
const RuleEnsembleGetRuleEnsemble () const
 
RuleEnsembleGetRuleEnsemblePtr ()
 
const RuleFitParamsGetRuleFitParams () const
 
RuleFitParamsGetRuleFitParamsPtr ()
 
const EventGetTrainingEvent (UInt_t i) const
 
const std::vector< const TMVA::Event * > & GetTrainingEvents () const
 
Double_t GetTrainingEventWeight (UInt_t i) const
 
void Initialize (const TMVA::MethodBase *rfbase)
 initialize the parameters of the RuleFit method and make rules More...
 
void InitNEveEff ()
 init effective number of events (using event weights) More...
 
void InitPtrs (const TMVA::MethodBase *rfbase)
 initialize pointers More...
 
void MakeDebugHists ()
 this will create a histograms intended rather for debugging or for the curious user More...
 
void MakeForest ()
 make a forest of decisiontrees More...
 
void MakeVisHists ()
 this will create histograms visualizing the rule ensemble More...
 
void NormVisHists (std::vector< TH2F * > &hlist)
 normalize rule importance hists More...
 
void ReshuffleEvents ()
 
void RestoreEventWeights ()
 save event weights - must be done before making the forest More...
 
void SaveEventWeights ()
 save event weights - must be done before making the forest More...
 
void SetGDNPathSteps (Int_t n=100)
 
void SetGDPathStep (Double_t s=0.01)
 
void SetGDTau (Double_t t=0.0)
 
void SetImportanceCut (Double_t minimp=0)
 
void SetMethodBase (const MethodBase *rfbase)
 set MethodBase More...
 
void SetModelFull ()
 
void SetModelLinear ()
 
void SetModelRules ()
 
void SetMsgType (EMsgType t)
 set the current message type to that of mlog for this class and all other subtools More...
 
void SetRuleMinDist (Double_t d)
 
void SetTrainingEvents (const std::vector< const TMVA::Event * > &el)
 set the training events randomly More...
 
void SetVisHistsUseImp (Bool_t f)
 
void UseCoefficientsVisHists ()
 
void UseImportanceVisHists ()
 

Private Member Functions

 RuleFit (const RuleFit &other)
 
void Copy (const RuleFit &other)
 copy method More...
 
MsgLoggerLog () const
 

Private Attributes

std::vector< Double_tfEventWeights
 
std::vector< const TMVA::DecisionTree * > fForest
 
MsgLoggerfLogger
 
const MethodBasefMethodBase
 
const MethodRuleFitfMethodRuleFit
 
Double_t fNEveEffTrain
 
UInt_t fNTreeSample
 
std::default_random_engine fRNGEngine
 
RuleEnsemble fRuleEnsemble
 
RuleFitParams fRuleFitParams
 
std::vector< const TMVA::Event * > fTrainingEvents
 
std::vector< const TMVA::Event * > fTrainingEventsRndm
 
Bool_t fVisHistsUseImp
 

Static Private Attributes

static const Int_t randSEED = 0
 

#include <TMVA/RuleFit.h>

Constructor & Destructor Documentation

◆ RuleFit() [1/3]

TMVA::RuleFit::RuleFit ( const TMVA::MethodBase rfbase)

constructor

Definition at line 64 of file RuleFit.cxx.

◆ RuleFit() [2/3]

TMVA::RuleFit::RuleFit ( void  )

default constructor

Definition at line 75 of file RuleFit.cxx.

◆ ~RuleFit()

TMVA::RuleFit::~RuleFit ( void  )
virtual

destructor

Definition at line 89 of file RuleFit.cxx.

◆ RuleFit() [3/3]

TMVA::RuleFit::RuleFit ( const RuleFit other)
private

Member Function Documentation

◆ Boost()

void TMVA::RuleFit::Boost ( TMVA::DecisionTree dt)

Boost the events.

The algorithm below is the called AdaBoost. See MethodBDT for details. Actually, this is a more or less copy of MethodBDT::AdaBoost().

Definition at line 338 of file RuleFit.cxx.

◆ BuildTree()

void TMVA::RuleFit::BuildTree ( TMVA::DecisionTree dt)

build the decision tree using fNTreeSample events from fTrainingEventsRndm

Definition at line 200 of file RuleFit.cxx.

◆ CalcImportance()

void TMVA::RuleFit::CalcImportance ( )

calculates the importance of each rule

Definition at line 417 of file RuleFit.cxx.

◆ CalcWeightSum()

Double_t TMVA::RuleFit::CalcWeightSum ( const std::vector< const TMVA::Event * > *  events,
UInt_t  neve = 0 
)

calculate the sum of weights

Definition at line 175 of file RuleFit.cxx.

◆ Copy()

void TMVA::RuleFit::Copy ( const RuleFit other)
private

copy method

Definition at line 159 of file RuleFit.cxx.

◆ EvalEvent()

Double_t TMVA::RuleFit::EvalEvent ( const Event e)

evaluate single event

Definition at line 431 of file RuleFit.cxx.

◆ FillCorr()

void TMVA::RuleFit::FillCorr ( TH2F h2,
const TMVA::Rule rule,
Int_t  v1,
Int_t  v2 
)

fill rule correlation between vx and vy, weighted with either the importance or the coefficient

Definition at line 607 of file RuleFit.cxx.

◆ FillCut()

void TMVA::RuleFit::FillCut ( TH2F h2,
const TMVA::Rule rule,
Int_t  vind 
)

Fill cut.

Definition at line 532 of file RuleFit.cxx.

◆ FillLin()

void TMVA::RuleFit::FillLin ( TH2F h2,
Int_t  vind 
)

fill lin

Definition at line 583 of file RuleFit.cxx.

◆ FillVisHistCorr()

void TMVA::RuleFit::FillVisHistCorr ( const Rule rule,
std::vector< TH2F * > &  hlist 
)

help routine to MakeVisHists() - fills for all correlation plots

Definition at line 714 of file RuleFit.cxx.

◆ FillVisHistCut()

void TMVA::RuleFit::FillVisHistCut ( const Rule rule,
std::vector< TH2F * > &  hlist 
)

help routine to MakeVisHists() - fills for all variables

Definition at line 683 of file RuleFit.cxx.

◆ FitCoefficients()

void TMVA::RuleFit::FitCoefficients ( )

Fit the coefficients for the rule ensemble.

Definition at line 408 of file RuleFit.cxx.

◆ ForestStatistics()

void TMVA::RuleFit::ForestStatistics ( )

summary of statistics of all trees

  • end-nodes: average and spread

Definition at line 385 of file RuleFit.cxx.

◆ GetCorrVars()

Bool_t TMVA::RuleFit::GetCorrVars ( TString title,
TString var1,
TString var2 
)

get first and second variables from title

Definition at line 753 of file RuleFit.cxx.

◆ GetForest()

const std::vector< const TMVA::DecisionTree *>& TMVA::RuleFit::GetForest ( ) const
inline

Definition at line 144 of file RuleFit.h.

◆ GetMethodBase()

const MethodBase* TMVA::RuleFit::GetMethodBase ( ) const
inline

Definition at line 150 of file RuleFit.h.

◆ GetMethodRuleFit()

const MethodRuleFit* TMVA::RuleFit::GetMethodRuleFit ( ) const
inline

Definition at line 149 of file RuleFit.h.

◆ GetNEveEff()

Double_t TMVA::RuleFit::GetNEveEff ( ) const
inline

Definition at line 132 of file RuleFit.h.

◆ GetNTreeSample()

UInt_t TMVA::RuleFit::GetNTreeSample ( ) const
inline

Definition at line 131 of file RuleFit.h.

◆ GetRndmSampleEvents()

void TMVA::RuleFit::GetRndmSampleEvents ( std::vector< const TMVA::Event * > &  evevec,
UInt_t  nevents 
)

draw a random subsample of the training events without replacement

Definition at line 466 of file RuleFit.cxx.

◆ GetRuleEnsemble()

const RuleEnsemble& TMVA::RuleFit::GetRuleEnsemble ( ) const
inline

Definition at line 145 of file RuleFit.h.

◆ GetRuleEnsemblePtr()

RuleEnsemble* TMVA::RuleFit::GetRuleEnsemblePtr ( )
inline

Definition at line 146 of file RuleFit.h.

◆ GetRuleFitParams()

const RuleFitParams& TMVA::RuleFit::GetRuleFitParams ( ) const
inline

Definition at line 147 of file RuleFit.h.

◆ GetRuleFitParamsPtr()

RuleFitParams* TMVA::RuleFit::GetRuleFitParamsPtr ( )
inline

Definition at line 148 of file RuleFit.h.

◆ GetTrainingEvent()

const Event* TMVA::RuleFit::GetTrainingEvent ( UInt_t  i) const
inline

Definition at line 133 of file RuleFit.h.

◆ GetTrainingEvents()

const std::vector< const TMVA::Event * >& TMVA::RuleFit::GetTrainingEvents ( ) const
inline

Definition at line 138 of file RuleFit.h.

◆ GetTrainingEventWeight()

Double_t TMVA::RuleFit::GetTrainingEventWeight ( UInt_t  i) const
inline

Definition at line 134 of file RuleFit.h.

◆ Initialize()

void TMVA::RuleFit::Initialize ( const TMVA::MethodBase rfbase)

initialize the parameters of the RuleFit method and make rules

Definition at line 119 of file RuleFit.cxx.

◆ InitNEveEff()

void TMVA::RuleFit::InitNEveEff ( )

init effective number of events (using event weights)

Definition at line 97 of file RuleFit.cxx.

◆ InitPtrs()

void TMVA::RuleFit::InitPtrs ( const TMVA::MethodBase rfbase)

initialize pointers

Definition at line 109 of file RuleFit.cxx.

◆ Log()

MsgLogger& TMVA::RuleFit::Log ( ) const
inlineprivate

Definition at line 174 of file RuleFit.h.

◆ MakeDebugHists()

void TMVA::RuleFit::MakeDebugHists ( )

this will create a histograms intended rather for debugging or for the curious user

Definition at line 936 of file RuleFit.cxx.

◆ MakeForest()

void TMVA::RuleFit::MakeForest ( )

make a forest of decisiontrees

Definition at line 221 of file RuleFit.cxx.

◆ MakeVisHists()

void TMVA::RuleFit::MakeVisHists ( )

this will create histograms visualizing the rule ensemble

Definition at line 776 of file RuleFit.cxx.

◆ NormVisHists()

void TMVA::RuleFit::NormVisHists ( std::vector< TH2F * > &  hlist)

normalize rule importance hists

if all weights are positive, the scale will be 1/maxweight if minimum weight < 0, then the scale will be 1/max(maxweight,abs(minweight))

Definition at line 485 of file RuleFit.cxx.

◆ ReshuffleEvents()

void TMVA::RuleFit::ReshuffleEvents ( )
inline

Definition at line 66 of file RuleFit.h.

◆ RestoreEventWeights()

void TMVA::RuleFit::RestoreEventWeights ( )

save event weights - must be done before making the forest

Definition at line 320 of file RuleFit.cxx.

◆ SaveEventWeights()

void TMVA::RuleFit::SaveEventWeights ( )

save event weights - must be done before making the forest

Definition at line 308 of file RuleFit.cxx.

◆ SetGDNPathSteps()

void TMVA::RuleFit::SetGDNPathSteps ( Int_t  n = 100)
inline

Definition at line 116 of file RuleFit.h.

◆ SetGDPathStep()

void TMVA::RuleFit::SetGDPathStep ( Double_t  s = 0.01)
inline

Definition at line 115 of file RuleFit.h.

◆ SetGDTau()

void TMVA::RuleFit::SetGDTau ( Double_t  t = 0.0)
inline

Definition at line 114 of file RuleFit.h.

◆ SetImportanceCut()

void TMVA::RuleFit::SetImportanceCut ( Double_t  minimp = 0)
inline

Definition at line 110 of file RuleFit.h.

◆ SetMethodBase()

void TMVA::RuleFit::SetMethodBase ( const MethodBase rfbase)

set MethodBase

Definition at line 150 of file RuleFit.cxx.

◆ SetModelFull()

void TMVA::RuleFit::SetModelFull ( )
inline

Definition at line 108 of file RuleFit.h.

◆ SetModelLinear()

void TMVA::RuleFit::SetModelLinear ( )
inline

Definition at line 104 of file RuleFit.h.

◆ SetModelRules()

void TMVA::RuleFit::SetModelRules ( )
inline

Definition at line 106 of file RuleFit.h.

◆ SetMsgType()

void TMVA::RuleFit::SetMsgType ( EMsgType  t)

set the current message type to that of mlog for this class and all other subtools

Definition at line 190 of file RuleFit.cxx.

◆ SetRuleMinDist()

void TMVA::RuleFit::SetRuleMinDist ( Double_t  d)
inline

Definition at line 112 of file RuleFit.h.

◆ SetTrainingEvents()

void TMVA::RuleFit::SetTrainingEvents ( const std::vector< const TMVA::Event * > &  el)

set the training events randomly

Definition at line 439 of file RuleFit.cxx.

◆ SetVisHistsUseImp()

void TMVA::RuleFit::SetVisHistsUseImp ( Bool_t  f)
inline

Definition at line 118 of file RuleFit.h.

◆ UseCoefficientsVisHists()

void TMVA::RuleFit::UseCoefficientsVisHists ( )
inline

Definition at line 120 of file RuleFit.h.

◆ UseImportanceVisHists()

void TMVA::RuleFit::UseImportanceVisHists ( )
inline

Definition at line 119 of file RuleFit.h.

Member Data Documentation

◆ fEventWeights

std::vector<Double_t> TMVA::RuleFit::fEventWeights
private

Definition at line 162 of file RuleFit.h.

◆ fForest

std::vector< const TMVA::DecisionTree *> TMVA::RuleFit::fForest
private

Definition at line 166 of file RuleFit.h.

◆ fLogger

MsgLogger* TMVA::RuleFit::fLogger
mutableprivate

Definition at line 173 of file RuleFit.h.

◆ fMethodBase

const MethodBase* TMVA::RuleFit::fMethodBase
private

Definition at line 170 of file RuleFit.h.

◆ fMethodRuleFit

const MethodRuleFit* TMVA::RuleFit::fMethodRuleFit
private

Definition at line 169 of file RuleFit.h.

◆ fNEveEffTrain

Double_t TMVA::RuleFit::fNEveEffTrain
private

Definition at line 165 of file RuleFit.h.

◆ fNTreeSample

UInt_t TMVA::RuleFit::fNTreeSample
private

Definition at line 163 of file RuleFit.h.

◆ fRNGEngine

std::default_random_engine TMVA::RuleFit::fRNGEngine
private

Definition at line 177 of file RuleFit.h.

◆ fRuleEnsemble

RuleEnsemble TMVA::RuleFit::fRuleEnsemble
private

Definition at line 167 of file RuleFit.h.

◆ fRuleFitParams

RuleFitParams TMVA::RuleFit::fRuleFitParams
private

Definition at line 168 of file RuleFit.h.

◆ fTrainingEvents

std::vector<const TMVA::Event *> TMVA::RuleFit::fTrainingEvents
private

Definition at line 160 of file RuleFit.h.

◆ fTrainingEventsRndm

std::vector<const TMVA::Event *> TMVA::RuleFit::fTrainingEventsRndm
private

Definition at line 161 of file RuleFit.h.

◆ fVisHistsUseImp

Bool_t TMVA::RuleFit::fVisHistsUseImp
private

Definition at line 171 of file RuleFit.h.

◆ randSEED

const Int_t TMVA::RuleFit::randSEED = 0
staticprivate

Definition at line 176 of file RuleFit.h.

Libraries for TMVA::RuleFit:
[legend]

The documentation for this class was generated from the following files: