118 fCutValue(
n.fCutValue ),
119 fCutType (
n.fCutType ),
120 fSelector(
n.fSelector ),
121 fResponse(
n.fResponse ),
123 fNodeType(
n.fNodeType ),
124 fPurity (
n.fPurity),
125 fIsTerminalNode(
n.fIsTerminalNode )
158 if (GetNFisherCoeff() == 0){
160 result = (
e.GetValueFast(this->GetSelector()) >= this->GetCutValue() );
180 if (!this->GoesRight(
e))
return kTRUE;
192 if ( ( this->GetNSigEvents() + this->GetNBkgEvents() ) > 0 ) {
193 fPurity = this->GetNSigEvents() / ( this->GetNSigEvents() + this->GetNBkgEvents());
196 Log() << kINFO <<
"Zero events in purity calculation , return purity=0.5" <<
Endl;
197 std::ostringstream
oss;
210 os <<
"< *** " << std::endl;
211 os <<
" d: " << this->GetDepth()
212 << std::setprecision(6)
213 <<
"NCoef: " << this->GetNFisherCoeff();
214 for (
Int_t i=0; i< (
Int_t) this->GetNFisherCoeff(); i++) { os <<
"fC"<<i<<
": " << this->GetFisherCoeff(i);}
215 os <<
" ivar: " << this->GetSelector()
216 <<
" cut: " << this->GetCutValue()
217 <<
" cType: " << this->GetCutType()
218 <<
" s: " << this->GetNSigEvents()
219 <<
" b: " << this->GetNBkgEvents()
220 <<
" nEv: " << this->GetNEvents()
221 <<
" suw: " << this->GetNSigEvents_unweighted()
222 <<
" buw: " << this->GetNBkgEvents_unweighted()
223 <<
" nEvuw: " << this->GetNEvents_unweighted()
224 <<
" sepI: " << this->GetSeparationIndex()
225 <<
" sepG: " << this->GetSeparationGain()
226 <<
" nType: " << this->GetNodeType()
229 os <<
"My address is " << (
Longptr_t)
this <<
", ";
230 if (this->GetParent() !=
NULL) os <<
" parent at addr: " << (
Longptr_t)this->GetParent();
231 if (this->GetLeft() !=
NULL) os <<
" left daughter at addr: " << (
Longptr_t)this->GetLeft();
232 if (this->GetRight() !=
NULL) os <<
" right daughter at addr: " << (
Longptr_t)this->GetRight();
234 os <<
" **** > " << std::endl;
242 os << this->GetDepth()
243 << std::setprecision(6)
244 <<
" " << this->GetPos()
245 <<
"NCoef: " << this->GetNFisherCoeff();
246 for (
Int_t i=0; i< (
Int_t) this->GetNFisherCoeff(); i++) {os <<
"fC"<<i<<
": " << this->GetFisherCoeff(i);}
247 os <<
" ivar: " << this->GetSelector()
248 <<
" cut: " << this->GetCutValue()
249 <<
" cType: " << this->GetCutType()
250 <<
" s: " << this->GetNSigEvents()
251 <<
" b: " << this->GetNBkgEvents()
252 <<
" nEv: " << this->GetNEvents()
253 <<
" suw: " << this->GetNSigEvents_unweighted()
254 <<
" buw: " << this->GetNBkgEvents_unweighted()
255 <<
" nEvuw: " << this->GetNEvents_unweighted()
256 <<
" sepI: " << this->GetSeparationIndex()
257 <<
" sepG: " << this->GetSeparationGain()
258 <<
" res: " << this->GetResponse()
259 <<
" rms: " << this->GetRMS()
260 <<
" nType: " << this->GetNodeType();
261 if (this->GetCC() > 10000000000000.) os <<
" CC: " << 100000. << std::endl;
262 else os <<
" CC: " << this->GetCC() << std::endl;
264 if (this->GetLeft() !=
NULL) this->GetLeft() ->PrintRec(os);
265 if (this->GetRight() !=
NULL) this->GetRight()->PrintRec(os);
286 this->SetDepth(
depth);
322 this->SetCutValue(
cutVal);
326 this->SetNSigEvents(
nsig);
327 this->SetNBkgEvents(
nbkg);
328 this->SetNEvents(
nEv);
350 SetNSigEvents_unweighted(0);
351 SetNBkgEvents_unweighted(0);
352 SetNEvents_unweighted(0);
353 SetSeparationIndex(-1);
354 SetSeparationGain(-1);
357 if (this->GetLeft() !=
NULL) ((
DecisionTreeNode*)(this->GetLeft()))->ClearNodeAndAllDaughters();
358 if (this->GetRight() !=
NULL) ((
DecisionTreeNode*)(this->GetRight()))->ClearNodeAndAllDaughters();
366 SetNBValidation( 0.0 );
367 SetNSValidation( 0.0 );
371 if(GetLeft() !=
NULL && GetRight() !=
NULL) {
372 GetLeft()->ResetValidationData();
373 GetRight()->ResetValidationData();
381 os <<
"----------------------" << std::endl
382 <<
"|~T_t| " << GetNTerminal() << std::endl
383 <<
"R(t): " << GetNodeR() << std::endl
384 <<
"R(T_t): " << GetSubTreeR() << std::endl
385 <<
"g(t): " << GetAlpha() << std::endl
386 <<
"G(t): " << GetAlphaMinSubtree() << std::endl;
393 this->PrintPrune(os);
394 if(this->GetLeft() !=
NULL && this->GetRight() !=
NULL) {
405 if (fTrainInfo) fTrainInfo->fCC =
cc;
406 else Log() << kFATAL <<
"call to SetCC without trainingInfo" <<
Endl;
416 else Log() << kFATAL <<
"You asked for Min of the event sample in node for variable "
417 <<
ivar <<
" that is out of range" <<
Endl;
428 else Log() << kFATAL <<
"You asked for Max of the event sample in node for variable "
429 <<
ivar <<
" that is out of range" <<
Endl;
439 if (
ivar >= fTrainInfo->fSampleMin.size()) fTrainInfo->fSampleMin.resize(
ivar+1);
449 if( ! fTrainInfo )
return;
450 if (
ivar >= fTrainInfo->fSampleMax.size() )
451 fTrainInfo->fSampleMax.resize(
ivar+1);
462 if (
gTools().HasAttr(node,
"NCoef")){
464 this->SetNFisherCoeff(
nCoef);
466 for (
Int_t i=0; i< (
Int_t) this->GetNFisherCoeff(); i++) {
468 this->SetFisherCoeff(i,tmp);
471 this->SetNFisherCoeff(0);
479 if(
gTools().HasAttr(node,
"purity") ) {
497 for (
Int_t i=0; i< (
Int_t) this->GetNFisherCoeff(); i++)
519 if ((
Int_t) fFisherCoeff.size()<
ivar+1) fFisherCoeff.resize(
ivar+1) ;
553 fgTmva_Version_Code = code;
561 return fgTmva_Version_Code;
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
float Float_t
Float 4 bytes (float)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
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)
void SetCC(Double_t cc)
Set CC, if traininfo defined, otherwise Log Fatal.
DTNodeTrainingInfo * fTrainInfo
virtual ~DecisionTreeNode()
destructor
void SetParent(Node *p) override
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
Bool_t GoesLeft(const Event &) const override
test event if it descends the tree at this node to the left
static UInt_t fgTmva_Version_Code
set only when read from weightfile
void SetLeft(Node *l) override
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
static void SetTmvaVersionCode(UInt_t code)
void SetPurity(void)
return the S/(S+B) (purity) for the node REM: even if nodes with purity 0.01 are very PURE background...
void ReadAttributes(void *node, UInt_t tmva_Version_Code=262657) override
void AddContentToNode(std::stringstream &s) const override
adding attributes to tree node (well, was used in BinarySearchTree, and somehow I guess someone progr...
void AddAttributesToNode(void *node) const override
add attribute to xml
DecisionTreeNode()
constructor of an essentially "empty" node floating in space
void Print(std::ostream &os) const override
print the node
static UInt_t GetTmvaVersionCode()
void ReadContent(std::stringstream &s) override
reading attributes from tree node (well, was used in BinarySearchTree, and somehow I guess someone pr...
Bool_t GoesRight(const Event &) const override
test event if it descends the tree at this node to the right
void ResetValidationData()
temporary stored node values (number of events, etc.) that originate not from the training but from t...
void SetRight(Node *r) override
Bool_t ReadDataRecord(std::istream &is, UInt_t tmva_Version_Code=262657) override
Read the data block.
static bool fgIsTraining
static variable to flag training phase in which we need fTrainInfo
void PrintRec(std::ostream &os) const override
recursively print the node and its daughters (--> print the 'tree')
Float_t GetSampleMax(UInt_t ivar) const
return the maximum of variable ivar from the training sample that pass/end up in this node,...
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,...
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)