94 fInput->
Connect(
"ValueSet(Long_t)",
"TMVA::StatDialogBDT",
this,
"SetItree()");
110 if(!fWfile.EndsWith(
".xml") ){
111 std::ifstream
fin( fWfile );
113 cout <<
"*** ERROR: Weight file: " << fWfile <<
" does not exist" << endl;
126 cout <<
"*** Huge problem: could not locate term \"NTrees\" in BDT weight file: "
128 cout <<
"==> panic abort (please contact the TMVA authors)" << endl;
150 cout <<
"--- Found " << fNtrees <<
" decision trees in weight file" << endl;
165 if (
n->GetLeft() !=
NULL){
171 if (
n->GetRight() !=
NULL){
190 snprintf( buffer, 25,
"N=%f",
n->GetNEvents() );
191 if (
n->GetNEvents()>0) t->
AddText(buffer);
192 snprintf( buffer, 25,
"S/(S+B)=%4.3f",
n->GetPurity() );
195 if (
n->GetNodeType() == 0){
196 if (
n->GetCutType()){
209 cout <<
"--- Reading Tree " <<
itree <<
" from weight file: " << fWfile << endl;
211 if(!fWfile.EndsWith(
".xml") ){
212 std::ifstream
fin( fWfile );
214 cout <<
"*** ERROR: Weight file: " << fWfile <<
" does not exist" << endl;
222 if (
itree >= fNtrees) {
223 cout <<
"*** ERROR: requested decision tree: " <<
itree
224 <<
", but number of trained trees only: " << fNtrees << endl;
232 fin >> dummy >> dummy >> dummy;
241 vars[
nVars]=
"FisherCrit";
257 if (
itree >= fNtrees) {
258 cout <<
"*** ERROR: requested decision tree: " <<
itree
259 <<
", but number of trained trees only: " << fNtrees << endl;
278 vars[
nVars]=
"FisherCrit";
301 cout <<
"--- Tree depth: " <<
depth << endl;
314 for (
int i=0;i<100;i++)
MyPalette[i] = fColorOffset+i;
323 if (!fCanvas) fCanvas =
new TCanvas(
"c1",
cbuffer, 200, 0, 1000, 600 );
324 else fCanvas->Clear();
363 cout <<
"--- Creating image: " <<
fname << endl;
385 cout <<
"*** Error in macro \"BDT.C\": cannot find directory \"Method_BDT\" in file: " <<
fin << endl;
393 std::vector<TString> path;
394 std::vector<TString>
wfile;
395 while ((key = (
TKey*)next())) {
398 cout <<
"*** Error in macro \"BDT.C\": cannot find sub-directory: " << key->GetName()
399 <<
" in directory: " <<
dir->GetName() << endl;
407 cout <<
"*** Error in macro \"BDT.C\": could not find TObjStrings \"TrainingPath\" and/or \"WeightFileName\" *** " << endl;
408 cout <<
"*** Maybe you are using TMVA >= 3.8.15 with an older training target file ? *** " << endl;
412 methname.push_back( key->GetName() );
413 path .push_back(
strPath->GetString() );
426 cbar->AddButton(
fname,
macro,
"Plot decision trees from this weight file",
"button" );
430 cbar->SetTextColor(
"blue");
454 wfile =
dataset+
"/weights/TMVAnalysis_test_BDT.weights.txt";
456 if(!
wfile.EndsWith(
".xml") ){
459 cout <<
"*** ERROR: Weight file: " <<
wfile <<
" does not exist" << endl;
463 std::cout <<
"test1";
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 r
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
static Int_t CreateGradientColorTable(UInt_t Number, Double_t *Stops, Double_t *Red, Double_t *Green, Double_t *Blue, UInt_t NColors, Float_t alpha=1., Bool_t setPalette=kTRUE)
Static function creating a color table with several connected linear gradients.
A Control Bar is a fully user configurable tool which provides fast access to frequently used operati...
TDirectory * GetDirectory(const char *apath, Bool_t printError=false, const char *funcname="GetDirectory") override
Find a directory named "apath".
Describe directory structure in memory.
virtual TDirectory * GetDirectory(const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory using apath.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
void MapWindow() override
map window
A composite frame that layout their children in horizontal way.
This class handles GUI labels.
This class describes layout hints used by the layout classes.
Defines top level windows that interact with the system Window Manager.
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
TGNumberEntry is a number entry input widget with up/down buttons.
virtual void SetLimits(ELimit limits=TGNumberFormat::kNELNoLimits, Double_t min=0, Double_t max=1)
virtual Double_t GetNumber() const
Yield an action as soon as it is clicked.
ROOT GUI Window base class.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Use the TLine constructor to create a simple line.
static void SetIsTraining(bool on)
Implementation of a Decision Tree.
TGTextButton * fDrawButton
TMVA::DecisionTree * ReadTree(TString *&vars, Int_t itree)
void DrawTree(Int_t itree)
TGHorizontalFrame * fButtons
StatDialogBDT(TString dataset, const TGWindow *p, TString wfile, TString methName="BDT", Int_t itree=0)
void DrawNode(TMVA::DecisionTreeNode *n, Double_t x, Double_t y, Double_t xscale, Double_t yscale, TString *vars)
recursively puts an entries in the histogram for the node and its daughters
static StatDialogBDT * fThis
TGTextButton * fCloseButton
std::vector< TControlBar * > BDT_Global__cbar
Collectable string class.
A Pave (see TPave) with text, lines or/and boxes inside.
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
void Draw(Option_t *option="") override
Draw this pavetext with its current attributes.
virtual void SetBorderSize(Int_t bordersize=4)
Sets the border size of the TPave box and shadow.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Int_t Atoi() const
Return integer value of string.
TString & ReplaceAll(const TString &s1, const TString &s2)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TStyle objects may be created to define special styles.
XMLNodePointer_t GetChild(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
returns first child of xmlnode
XMLNodePointer_t DocGetRootElement(XMLDocPointer_t xmldoc)
returns root node of document
XMLDocPointer_t ParseFile(const char *filename, Int_t maxbuf=100000)
Parses content of file and tries to produce xml structures.
XMLNodePointer_t GetNext(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
return next to xmlnode node if realnode==kTRUE, any special nodes in between will be skipped
void Initialize(Bool_t useTMVAStyle=kTRUE)
TFile * OpenFile(const TString &fin)
void imgconv(TCanvas *c, const TString &fname)
void BDT_DeleteTBar(int i)
void BDT(TString dataset, const TString &fin="TMVA.root")