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...
 
virtual TClassIsA () const
 
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)
 
virtual void Streamer (TBuffer &)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
void UseCoefficientsVisHists ()
 
void UseImportanceVisHists ()
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 

Private Member Functions

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

Private Attributes

std::vector< Double_tfEventWeights
 original weights of the events - follows fTrainingEvents More...
 
std::vector< const TMVA::DecisionTree * > fForest
 the input forest of decision trees More...
 
MsgLoggerfLogger
 message logger More...
 
const MethodBasefMethodBase
 pointer the method base which initialized this RuleFit instance More...
 
const MethodRuleFitfMethodRuleFit
 pointer the method which initialized this RuleFit instance More...
 
Double_t fNEveEffTrain
 reweighted number of events = sum(wi) More...
 
UInt_t fNTreeSample
 number of events in sub sample = frac*neve More...
 
std::default_random_engine fRNGEngine
 
RuleEnsemble fRuleEnsemble
 the ensemble of rules More...
 
RuleFitParams fRuleFitParams
 fit rule parameters More...
 
std::vector< const TMVA::Event * > fTrainingEvents
 all training events More...
 
std::vector< const TMVA::Event * > fTrainingEventsRndm
 idem, but randomly shuffled More...
 
Bool_t fVisHistsUseImp
 if true, use importance as weight; else coef in vis hists More...
 

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 328 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 407 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.

◆ Class()

static TClass * TMVA::RuleFit::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * TMVA::RuleFit::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static constexpr Version_t TMVA::RuleFit::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 179 of file RuleFit.h.

◆ Copy()

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

copy method

Definition at line 159 of file RuleFit.cxx.

◆ DeclFileName()

static const char * TMVA::RuleFit::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 179 of file RuleFit.h.

◆ EvalEvent()

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

evaluate single event

Definition at line 421 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 597 of file RuleFit.cxx.

◆ FillCut()

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

Fill cut.

Definition at line 522 of file RuleFit.cxx.

◆ FillLin()

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

fill lin

Definition at line 573 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 704 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 673 of file RuleFit.cxx.

◆ FitCoefficients()

void TMVA::RuleFit::FitCoefficients ( )

Fit the coefficients for the rule ensemble.

Definition at line 398 of file RuleFit.cxx.

◆ ForestStatistics()

void TMVA::RuleFit::ForestStatistics ( )

summary of statistics of all trees

  • end-nodes: average and spread

Definition at line 375 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 743 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 456 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.

◆ IsA()

virtual TClass * TMVA::RuleFit::IsA ( ) const
inlinevirtual
Returns
TClass describing current object

Definition at line 179 of file RuleFit.h.

◆ 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 926 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 766 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 475 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 310 of file RuleFit.cxx.

◆ SaveEventWeights()

void TMVA::RuleFit::SaveEventWeights ( )

save event weights - must be done before making the forest

Definition at line 298 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 429 of file RuleFit.cxx.

◆ SetVisHistsUseImp()

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

Definition at line 118 of file RuleFit.h.

◆ Streamer()

virtual void TMVA::RuleFit::Streamer ( TBuffer )
virtual

◆ StreamerNVirtual()

void TMVA::RuleFit::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 179 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

original weights of the events - follows fTrainingEvents

Definition at line 162 of file RuleFit.h.

◆ fForest

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

the input forest of decision trees

Definition at line 166 of file RuleFit.h.

◆ fLogger

MsgLogger* TMVA::RuleFit::fLogger
mutableprivate

message logger

Definition at line 173 of file RuleFit.h.

◆ fMethodBase

const MethodBase* TMVA::RuleFit::fMethodBase
private

pointer the method base which initialized this RuleFit instance

Definition at line 170 of file RuleFit.h.

◆ fMethodRuleFit

const MethodRuleFit* TMVA::RuleFit::fMethodRuleFit
private

pointer the method which initialized this RuleFit instance

Definition at line 169 of file RuleFit.h.

◆ fNEveEffTrain

Double_t TMVA::RuleFit::fNEveEffTrain
private

reweighted number of events = sum(wi)

Definition at line 165 of file RuleFit.h.

◆ fNTreeSample

UInt_t TMVA::RuleFit::fNTreeSample
private

number of events in sub sample = frac*neve

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

the ensemble of rules

Definition at line 167 of file RuleFit.h.

◆ fRuleFitParams

RuleFitParams TMVA::RuleFit::fRuleFitParams
private

fit rule parameters

Definition at line 168 of file RuleFit.h.

◆ fTrainingEvents

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

all training events

Definition at line 160 of file RuleFit.h.

◆ fTrainingEventsRndm

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

idem, but randomly shuffled

Definition at line 161 of file RuleFit.h.

◆ fVisHistsUseImp

Bool_t TMVA::RuleFit::fVisHistsUseImp
private

if true, use importance as weight; else coef in vis hists

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: