129 if (
n.GetLeft() == 0 ) this->
SetLeft(NULL);
132 if (
n.GetRight() == 0 ) this->
SetRight(NULL);
197 Log() << kINFO <<
"Zero events in purity calculation , return purity=0.5" <<
Endl;
198 std::ostringstream oss;
211 os <<
"< *** " << std::endl;
213 << std::setprecision(6)
230 os <<
"My address is " << (
Longptr_t)
this <<
", ";
235 os <<
" **** > " << std::endl;
244 << std::setprecision(6)
260 <<
" rms: " << this->
GetRMS()
262 if (this->
GetCC() > 10000000000000.) os <<
" CC: " << 100000. << std::endl;
263 else os <<
" CC: " << this->
GetCC() << std::endl;
277 Float_t cutVal, cutType, nsig, nbkg, nEv, nsig_unweighted, nbkg_unweighted, nEv_unweighted;
278 Float_t separationIndex, separationGain, response(-99), cc(0);
279 Int_t depth, ivar, nodeType;
284 if ( depth==-1 ) {
return kFALSE; }
298 >> tmp >> nsig_unweighted
299 >> tmp >> nbkg_unweighted
300 >> tmp >> nEv_unweighted
301 >> tmp >> separationIndex
302 >> tmp >> separationGain
312 >> tmp >> nsig_unweighted
313 >> tmp >> nbkg_unweighted
314 >> tmp >> nEv_unweighted
315 >> tmp >> separationIndex
316 >> tmp >> separationGain
373 GetLeft()->ResetValidationData();
382 os <<
"----------------------" << std::endl
384 <<
"R(t): " <<
GetNodeR() << std::endl
386 <<
"g(t): " <<
GetAlpha() << std::endl
407 else Log() << kFATAL <<
"call to SetCC without trainingInfo" <<
Endl;
417 else Log() << kFATAL <<
"You asked for Min of the event sample in node for variable "
418 << ivar <<
" that is out of range" <<
Endl;
429 else Log() << kFATAL <<
"You asked for Max of the event sample in node for variable "
430 << ivar <<
" that is out of range" <<
Endl;
460 Float_t tempNSigEvents,tempNBkgEvents;
463 if (
gTools().HasAttr(node,
"NCoef")){
480 if(
gTools().HasAttr(node,
"purity") ) {
485 fPurity = tempNSigEvents / (tempNSigEvents + tempNBkgEvents);
544 TTHREAD_TLS_DECL_ARG(
MsgLogger,logger,
"DecisionTreeNode");
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
void Print(GNN_Data &d, std::string txt="")
#define TMVA_VERSION(a, b, c)
virtual void AddContentToNode(std::stringstream &s) const
adding attributes to tree node (well, was used in BinarySearchTree, and somehow I guess someone progr...
void SetNEvents_unweighted(Float_t nev)
set the number of unweighted events that entered the node (during training), if traininfo defined
virtual void ReadAttributes(void *node, UInt_t tmva_Version_Code=262657)
void SetCC(Double_t cc)
Set CC, if traininfo defined, otherwise Log Fatal.
DTNodeTrainingInfo * fTrainInfo
Bool_t fIsTerminalNode
! flag to set node as terminal (i.e., without deleting its descendants)
virtual ~DecisionTreeNode()
destructor
Float_t GetNSigEvents_unweighted(void) const
Float_t GetNBkgEvents_unweighted(void) const
return the sum of unweighted backgr weights in the node, or -1 if traininfo undefined
void SetNodeType(Int_t t)
set node type: 1 signal node, -1 bkg leave, 0 intermediate Node
Int_t fNodeType
Type of node: -1 == Bkg-leaf, 1 == Signal-leaf, 0 = internal.
Double_t GetSubTreeR() const
return the resubstitution estimate, R(T_t), of the tree rooted at this node, or -1 if traininfo undef...
Float_t GetSeparationIndex(void) const
return the separation index AT this node, or 0 if traininfo undefined
void SetSeparationGain(Float_t sep)
set the separation, or information gained BY this node's selection, if traininfo defined
void SetNBkgEvents(Float_t b)
set the sum of the backgr weights in the node, if traininfo defined
void SetCutType(Bool_t t)
set true: if event variable > cutValue ==> signal , false otherwise
static void SetIsTraining(bool on)
void PrintPrune(std::ostream &os) const
printout of the node (can be read in with ReadDataRecord)
void PrintRecPrune(std::ostream &os) const
recursive printout of the node and its daughters
void SetFisherCoeff(Int_t ivar, Double_t coeff)
set fisher coefficients
void SetSumTarget2(Float_t t2)
set sum target 2, if traininfo defined
Float_t fRMS
response RMS of the regression node
static UInt_t fgTmva_Version_Code
set only when read from weightfile
Short_t fSelector
index of variable used in node selection (decision tree)
Float_t GetNSigEvents(void) const
return the sum of the signal weights in the node, or -1 if traininfo undefined
Float_t fPurity
the node purity
virtual void SetLeft(Node *l)
Double_t GetAlphaMinSubtree() const
return the minimum alpha in the tree rooted at this node, or -1 if traininfo undefined
Float_t GetNEvents_unweighted(void) const
return the number of unweighted events that entered the node (during training), or -1 if traininfo un...
UInt_t GetNFisherCoeff() const
void SetSampleMax(UInt_t ivar, Float_t xmax)
set the maximum of variable ivar from the training sample that pass/end up in this node,...
void ClearNodeAndAllDaughters()
clear the nodes (their S/N, Nevents etc), just keep the structure of the tree
virtual Bool_t GoesLeft(const Event &) const
test event if it descends the tree at this node to the left
static void SetTmvaVersionCode(UInt_t code)
virtual void ReadContent(std::stringstream &s)
reading attributes from tree node (well, was used in BinarySearchTree, and somehow I guess someone pr...
void SetNBValidation(Double_t b)
set number of background events from the pruning validation sample, if traininfo defined
Float_t GetRMS(void) const
return the RMS of the response of the node (for regression)
void SetPurity(void)
return the S/(S+B) (purity) for the node REM: even if nodes with purity 0.01 are very PURE background...
virtual void Print(std::ostream &os) const
print the node
virtual DecisionTreeNode * GetLeft() const
Double_t GetNodeR() const
return the node resubstitution estimate, R(t), for Cost Complexity pruning, or -1 if traininfo undefi...
Float_t fCutValue
cut value applied on this node to discriminate bkg against sig
virtual Bool_t GoesRight(const Event &) const
test event if it descends the tree at this node to the right
DecisionTreeNode()
constructor of an essentially "empty" node floating in space
void SetNFisherCoeff(Int_t nvars)
virtual void AddAttributesToNode(void *node) const
add attribute to xml
Short_t GetSelector() const
return index of variable used for discrimination at this node
virtual Bool_t ReadDataRecord(std::istream &is, UInt_t tmva_Version_Code=262657)
Read the data block.
static UInt_t GetTmvaVersionCode()
void SetNSigEvents(Float_t s)
set the sum of the signal weights in the node, if traininfo defined
Float_t GetResponse(void) const
return the response of the node (for regression)
Float_t GetCutValue(void) const
return the cut value applied at this node
Int_t GetNodeType(void) const
return node type: 1 signal node, -1 bkg leave, 0 intermediate Node
Double_t GetAlpha() const
return the critical point alpha, or -1 if traininfo undefined
Int_t GetNTerminal() const
return number of terminal nodes in the subtree rooted here, or -1 if traininfo undefined
Bool_t fCutType
true: if event variable > cutValue ==> signal , false otherwise
Bool_t GetCutType(void) const
return kTRUE: Cuts select signal, kFALSE: Cuts select bkg
void ResetValidationData()
temporary stored node values (number of events, etc.) that originate not from the training but from t...
virtual void PrintRec(std::ostream &os) const
recursively print the node and its daughters (--> print the 'tree')
void SetNSigEvents_unweighted(Float_t s)
set the sum of the unweighted signal events in the node, if traininfo defined
Float_t GetNEvents(void) const
return the number of events that entered the node (during training), or -1 if traininfo undefined
Double_t GetCC() const
return CC, or -1 if traininfo undefined
static bool fgIsTraining
static variable to flag training phase in which we need fTrainInfo
void SetSeparationIndex(Float_t sep)
set the chosen index, measure of "purity" (separation between S and B) AT this node,...
virtual void SetRight(Node *r)
Float_t fResponse
response value in case of regression
void SetSumTarget(Float_t t)
set sum target, if traininfo defined
virtual void SetParent(Node *p)
Float_t GetPurity(void) const
return S/(S+B) (purity) at this node (from training)
Float_t GetSeparationGain(void) const
return the gain in separation obtained by this node's selection, or -1 if traininfo undefined
Float_t GetSampleMax(UInt_t ivar) const
return the maximum of variable ivar from the training sample that pass/end up in this node,...
void SetCutValue(Float_t c)
set the cut value applied at this node
Float_t GetNBkgEvents(void) const
return the sum of the backgr weights in the node, or -1 if traininfo undefined
Float_t GetSampleMin(UInt_t ivar) const
return the minimum of variable ivar from the training sample that pass/end up in this node,...
void SetSampleMin(UInt_t ivar, Float_t xmin)
set the minimum of variable ivar from the training sample that pass/end up in this node,...
void SetSelector(Short_t i)
set index of variable used for discrimination at this node
std::vector< Double_t > fFisherCoeff
the fisher coeff (offset at the last element)
virtual DecisionTreeNode * GetParent() const
Double_t GetFisherCoeff(Int_t ivar) const
get fisher coefficients
void SetNBkgEvents_unweighted(Float_t b)
set the sum of the unweighted backgr events in the node, if traininfo defined
void SetNSValidation(Double_t s)
set number of signal events from the pruning validation sample, if traininfo defined
void SetNEvents(Float_t nev)
set the number of events that entered the node (during training), if traininfo defined
virtual DecisionTreeNode * GetRight() const
ostringstream derivative to redirect and format output
Node for the BinarySearch or Decision Trees.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
create variable transformations
MsgLogger & Endl(MsgLogger &ml)