Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMVA::Rule Class Reference

Implementation of a rule.

A rule is simply a branch or a part of a branch in a tree. It fulfills the following:

  • First node is the root node of the originating tree
  • Consists of a minimum of 2 nodes
  • A rule returns for a given event:
    • 0 : if the event fails at any node
    • 1 : otherwise
  • If the rule contains <2 nodes, it returns 0 SHOULD NOT HAPPEN!

The coefficient is found by either brute force or some sort of intelligent fitting. See the RuleEnsemble class for more info.

Definition at line 50 of file Rule.h.

Public Member Functions

 Rule ()
 the simple constructor
 
 Rule (const Rule &other)
 
 Rule (RuleEnsemble *re)
 the simple constructor
 
 Rule (RuleEnsemble *re, const std::vector< const TMVA::Node * > &nodes)
 the main constructor for a Rule
 
virtual ~Rule ()
 destructor
 
void * AddXMLTo (void *parent) const
 
void CalcImportance ()
 
Bool_t ContainsVariable (UInt_t iv) const
 check if variable in node
 
Bool_t Equal (const Rule &other, Bool_t useCutValue, Double_t maxdist) const
 Compare two rules.
 
Bool_t EvalEvent (const Event &e) const
 
Double_t GetCoefficient () const
 
Double_t GetImportance () const
 
Double_t GetImportanceRef () const
 
UInt_t GetNcuts () const
 
Double_t GetNorm () const
 
UInt_t GetNumVarsUsed () const
 
Double_t GetRelImportance () const
 
const RuleCutGetRuleCut () const
 
const RuleEnsembleGetRuleEnsemble () const
 
Double_t GetSigma () const
 
Double_t GetSSB () const
 
Double_t GetSSBNeve () const
 
Double_t GetSupport () const
 
Bool_t IsSignalRule () const
 
Bool_t operator< (const Rule &other) const
 comparison operator <
 
void operator= (const Rule &other)
 
Bool_t operator== (const Rule &other) const
 comparison operator ==
 
void PrintLogger (const char *title=nullptr) const
 print function
 
void PrintRaw (std::ostream &os) const
 extensive print function used to print info for the weight file
 
void ReadFromXML (void *wghtnode)
 read rule from XML
 
void ReadRaw (std::istream &os)
 read function (format is the same as written by PrintRaw)
 
Double_t RuleDist (const Rule &other, Bool_t useCutValue) const
 Returns:
 
void SetCoefficient (Double_t v)
 
void SetImportanceRef (Double_t v)
 
void SetMsgType (EMsgType t)
 
void SetNorm (Double_t norm)
 
void SetRuleCut (RuleCut *rc)
 
void SetRuleEnsemble (const RuleEnsemble *re)
 
void SetSSB (Double_t v)
 
void SetSSBNeve (Double_t v)
 
void SetSupport (Double_t v)
 

Private Member Functions

void Copy (const Rule &other)
 copy function
 
const TStringGetVarName (Int_t i) const
 returns the name of a rule
 
MsgLoggerLog () const
 
void Print (std::ostream &os) const
 print function
 
void SetSigma (Double_t v)
 

Private Attributes

Double_t fCoefficient
 rule coeff. a(k)
 
RuleCutfCut
 all cuts associated with the rule
 
Double_t fImportance
 importance of rule
 
Double_t fImportanceRef
 importance ref
 
MsgLoggerfLogger
 ! message logger
 
Double_t fNorm
 normalization - usually 1.0/t(k)
 
const RuleEnsemblefRuleEnsemble
 pointer to parent RuleEnsemble
 
Double_t fSigma
 t(k) = sqrt(s*(1-s))
 
Double_t fSSB
 S/(S+B) for rule.
 
Double_t fSSBNeve
 N(events) reaching the last node in reevaluation.
 
Double_t fSupport
 s(k)
 

Friends

std::ostream & operator<< (std::ostream &os, const Rule &rule)
 

#include <TMVA/Rule.h>

Constructor & Destructor Documentation

◆ Rule() [1/4]

TMVA::Rule::Rule ( RuleEnsemble re,
const std::vector< const TMVA::Node * > &  nodes 
)

the main constructor for a Rule

Definition at line 66 of file Rule.cxx.

◆ Rule() [2/4]

TMVA::Rule::Rule ( RuleEnsemble re)

the simple constructor

Definition at line 94 of file Rule.cxx.

◆ Rule() [3/4]

TMVA::Rule::Rule ( const Rule other)
inline

Definition at line 64 of file Rule.h.

◆ Rule() [4/4]

TMVA::Rule::Rule ( )

the simple constructor

Definition at line 112 of file Rule.cxx.

◆ ~Rule()

TMVA::Rule::~Rule ( )
virtual

destructor

Definition at line 130 of file Rule.cxx.

Member Function Documentation

◆ AddXMLTo()

void * TMVA::Rule::AddXMLTo ( void *  parent) const

Definition at line 398 of file Rule.cxx.

◆ CalcImportance()

void TMVA::Rule::CalcImportance ( )
inline

Definition at line 99 of file Rule.h.

◆ ContainsVariable()

Bool_t TMVA::Rule::ContainsVariable ( UInt_t  iv) const

check if variable in node

Definition at line 139 of file Rule.cxx.

◆ Copy()

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

copy function

Definition at line 284 of file Rule.cxx.

◆ Equal()

Bool_t TMVA::Rule::Equal ( const Rule other,
Bool_t  useCutValue,
Double_t  mindist 
) const

Compare two rules.

  • useCutValue:
    • true -> calculate a distance between the two rules based on the cut values if the rule cuts are not equal, the distance is < 0 (-1.0) return true if d<mindist
    • false-> ignore mindist, return true if rules are equal, ignoring cut values
  • mindist: min distance allowed between rules; if < 0 => set useCutValue=false;

Definition at line 172 of file Rule.cxx.

◆ EvalEvent()

Bool_t TMVA::Rule::EvalEvent ( const Event e) const
inline

Definition at line 191 of file Rule.h.

◆ GetCoefficient()

Double_t TMVA::Rule::GetCoefficient ( ) const
inline

Definition at line 141 of file Rule.h.

◆ GetImportance()

Double_t TMVA::Rule::GetImportance ( ) const
inline

Definition at line 145 of file Rule.h.

◆ GetImportanceRef()

Double_t TMVA::Rule::GetImportanceRef ( ) const
inline

Definition at line 146 of file Rule.h.

◆ GetNcuts()

UInt_t TMVA::Rule::GetNcuts ( ) const
inline

Definition at line 133 of file Rule.h.

◆ GetNorm()

Double_t TMVA::Rule::GetNorm ( ) const
inline

Definition at line 144 of file Rule.h.

◆ GetNumVarsUsed()

UInt_t TMVA::Rule::GetNumVarsUsed ( ) const
inline

Definition at line 130 of file Rule.h.

◆ GetRelImportance()

Double_t TMVA::Rule::GetRelImportance ( ) const
inline

Definition at line 102 of file Rule.h.

◆ GetRuleCut()

const RuleCut * TMVA::Rule::GetRuleCut ( ) const
inline

Definition at line 139 of file Rule.h.

◆ GetRuleEnsemble()

const RuleEnsemble * TMVA::Rule::GetRuleEnsemble ( ) const
inline

Definition at line 140 of file Rule.h.

◆ GetSigma()

Double_t TMVA::Rule::GetSigma ( ) const
inline

Definition at line 143 of file Rule.h.

◆ GetSSB()

Double_t TMVA::Rule::GetSSB ( ) const
inline

Definition at line 117 of file Rule.h.

◆ GetSSBNeve()

Double_t TMVA::Rule::GetSSBNeve ( ) const
inline

Definition at line 118 of file Rule.h.

◆ GetSupport()

Double_t TMVA::Rule::GetSupport ( ) const
inline

Definition at line 142 of file Rule.h.

◆ GetVarName()

const TString & TMVA::Rule::GetVarName ( Int_t  i) const
private

returns the name of a rule

Definition at line 276 of file Rule.cxx.

◆ IsSignalRule()

Bool_t TMVA::Rule::IsSignalRule ( ) const
inline

Definition at line 119 of file Rule.h.

◆ Log()

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

Definition at line 184 of file Rule.h.

◆ operator<()

Bool_t TMVA::Rule::operator< ( const Rule other) const

comparison operator <

Definition at line 259 of file Rule.cxx.

◆ operator=()

void TMVA::Rule::operator= ( const Rule other)
inline

Definition at line 122 of file Rule.h.

◆ operator==()

Bool_t TMVA::Rule::operator== ( const Rule other) const

comparison operator ==

Definition at line 251 of file Rule.cxx.

◆ Print()

void TMVA::Rule::Print ( std::ostream &  os) const
private

print function

Definition at line 303 of file Rule.cxx.

◆ PrintLogger()

void TMVA::Rule::PrintLogger ( const char *  title = nullptr) const

print function

Definition at line 335 of file Rule.cxx.

◆ PrintRaw()

void TMVA::Rule::PrintRaw ( std::ostream &  os) const

extensive print function used to print info for the weight file

Definition at line 367 of file Rule.cxx.

◆ ReadFromXML()

void TMVA::Rule::ReadFromXML ( void *  wghtnode)

read rule from XML

Definition at line 428 of file Rule.cxx.

◆ ReadRaw()

void TMVA::Rule::ReadRaw ( std::istream &  os)

read function (format is the same as written by PrintRaw)

Definition at line 477 of file Rule.cxx.

◆ RuleDist()

Double_t TMVA::Rule::RuleDist ( const Rule other,
Bool_t  useCutValue 
) const

Returns:

  • -1.0 : rules are NOT equal, i.e, variables and/or cut directions are wrong
  • >=0: rules are equal apart from the cutvalue, returns \( d = \sqrt{\sum(c1-c2)^2} \)

If not useCutValue, the distance is exactly zero if they are equal

Definition at line 192 of file Rule.cxx.

◆ SetCoefficient()

void TMVA::Rule::SetCoefficient ( Double_t  v)
inline

Definition at line 84 of file Rule.h.

◆ SetImportanceRef()

void TMVA::Rule::SetImportanceRef ( Double_t  v)
inline

Definition at line 96 of file Rule.h.

◆ SetMsgType()

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

Definition at line 156 of file Rule.cxx.

◆ SetNorm()

void TMVA::Rule::SetNorm ( Double_t  norm)
inline

Definition at line 81 of file Rule.h.

◆ SetRuleCut()

void TMVA::Rule::SetRuleCut ( RuleCut rc)
inline

Definition at line 78 of file Rule.h.

◆ SetRuleEnsemble()

void TMVA::Rule::SetRuleEnsemble ( const RuleEnsemble re)
inline

Definition at line 75 of file Rule.h.

◆ SetSigma()

void TMVA::Rule::SetSigma ( Double_t  v)
inlineprivate

Definition at line 161 of file Rule.h.

◆ SetSSB()

void TMVA::Rule::SetSSB ( Double_t  v)
inline

Definition at line 90 of file Rule.h.

◆ SetSSBNeve()

void TMVA::Rule::SetSSBNeve ( Double_t  v)
inline

Definition at line 93 of file Rule.h.

◆ SetSupport()

void TMVA::Rule::SetSupport ( Double_t  v)
inline

Definition at line 87 of file Rule.h.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const Rule rule 
)
friend

Member Data Documentation

◆ fCoefficient

Double_t TMVA::Rule::fCoefficient
private

rule coeff. a(k)

Definition at line 176 of file Rule.h.

◆ fCut

RuleCut* TMVA::Rule::fCut
private

all cuts associated with the rule

Definition at line 172 of file Rule.h.

◆ fImportance

Double_t TMVA::Rule::fImportance
private

importance of rule

Definition at line 177 of file Rule.h.

◆ fImportanceRef

Double_t TMVA::Rule::fImportanceRef
private

importance ref

Definition at line 178 of file Rule.h.

◆ fLogger

MsgLogger* TMVA::Rule::fLogger
mutableprivate

! message logger

Definition at line 183 of file Rule.h.

◆ fNorm

Double_t TMVA::Rule::fNorm
private

normalization - usually 1.0/t(k)

Definition at line 173 of file Rule.h.

◆ fRuleEnsemble

const RuleEnsemble* TMVA::Rule::fRuleEnsemble
private

pointer to parent RuleEnsemble

Definition at line 179 of file Rule.h.

◆ fSigma

Double_t TMVA::Rule::fSigma
private

t(k) = sqrt(s*(1-s))

Definition at line 175 of file Rule.h.

◆ fSSB

Double_t TMVA::Rule::fSSB
private

S/(S+B) for rule.

Definition at line 180 of file Rule.h.

◆ fSSBNeve

Double_t TMVA::Rule::fSSBNeve
private

N(events) reaching the last node in reevaluation.

Definition at line 181 of file Rule.h.

◆ fSupport

Double_t TMVA::Rule::fSupport
private

s(k)

Definition at line 174 of file Rule.h.

Libraries for TMVA::Rule:

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