28 Float_t x0L = 0.107, y0H = 0.899;
29 Float_t dxL = 0.557-x0L, dyH = 0.22;
39 TString ftit =
"Training History";
41 TString hNameRef =
"TrainingHistory";
45 UInt_t xnm = TMVAGlob::GetListOfMethods( xmethods ,BinDir);
47 cout <<
"ups .. no methods found in to plot training history for ... give up" << endl;
50 TIter xnext(&xmethods);
53 while ((xkey = (
TKey*)xnext())) {
56 UInt_t ninst = TMVAGlob::GetListOfTitles(mDir,titles);
57 if (ninst==0) cout <<
"hmm... sorry, but this printout was supposed to be only to keep the compiler quite.. never supposed to happen :(" << endl;
58 TIter nextTitle(&titles);
61 while ((titkey = TMVAGlob::NextKey(nextTitle,
"TDirectory"))) {
64 TMVAGlob::GetMethodTitle(methodTitle,titDir);
67 while ((hkey2 = TMVAGlob::NextKey(nextKey,
"TH1"))) {
72 if (
h->GetMaximum() > y2) y2 =
h->GetMaximum()*1.1;
73 if (
h->GetMinimum() < y1) y1 =
h->GetMinimum();
74 if (
h->GetBinLowEdge(0) <
x1 )
x1 =
h->GetBinLowEdge(0);
75 if (
h->GetBinLowEdge(
h->GetNbinsX()+1 ) >
x2 )
x2 =
h->GetBinLowEdge(
h->GetNbinsX()+1 );
84 if(
gROOT->FindObject(
"frame")!=0)
gROOT->FindObject(
"frame")->Delete();
85 TH2F* frame =
new TH2F(
"frame", ftit, 500,
x1,
x2, 500, y1, y2 );
88 TMVAGlob::SetFrameStyle( frame, 1.0 );
98 UInt_t nm = TMVAGlob::GetListOfMethods( methods,BinDir );
100 cout <<
"ups .. no methods found in to plot ROC curve for ... give up" << endl;
104 TIter next(&methods);
107 while ((key = (
TKey*)next())) {
110 UInt_t ninst = TMVAGlob::GetListOfTitles(mDir,titles);
111 if (ninst==0) cout <<
"hmm... sorry, but this printout was supposed to be only to keep the compiler quite.. never supposed to happen :(" << endl;
112 TIter nextTitle(&titles);
115 while ((titkey = TMVAGlob::NextKey(nextTitle,
"TDirectory"))) {
118 TMVAGlob::GetMethodTitle(methodTitle,titDir);
121 while ((hkey2 = TMVAGlob::NextKey(nextKey,
"TH1"))) {
126 h->SetLineColor(color);
127 color++;
if (color == 5 || color == 10 || color == 11) color++;
140 TH1* histWithLargestInt(0);
141 while ((hist = (
TH1*)hIt())!=0) {
142 Double_t integral = hist->Integral(1,hist->FindBin(0.9999));
143 if (integral>largestInt) {
144 largestInt = integral;
145 histWithLargestInt = hist;
148 if (histWithLargestInt == 0) {
149 cout <<
"ERROR - unknown hist \"histWithLargestInt\" --> serious problem in ROOT file" << endl;
154 legend->
AddEntry(histWithLargestInt, histLabel,
"l");
155 hists.
Remove(histWithLargestInt);
161 legend->
SetY1( y0H - dyH);
164 frame->
Draw(
"sameaxis");
165 legend->
Draw(
"same");
169 if (__PLOT_LOGO__) TMVAGlob::plot_logo();
175 TString fname = dataset+
"/plots/" + hNameRef;
178 fprepend.ReplaceAll(
"multicutMVA_",
"");
179 fname = dataset+
"plots/" + fprepend +
"_" + hNameRef;
181 if (__SAVE_IMAGE__) TMVAGlob::imgconv(
c, fname );
190 TMVAGlob::Initialize( useTMVAStyle );
static const double x2[5]
static const double x1[5]
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Describe directory structure in memory.
virtual TList * GetListOfKeys() const
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
TH1 is the base class of all histogram classes in ROOT.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual void Draw(Option_t *option="")
Draw this histogram with options.
2-D histogram with a float per channel (see TH1 documentation)}
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual TObject * ReadObj()
To read a TObject* from the file.
This class displays a legend box (TPaveText) containing several legend entries.
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
virtual void SetHeader(const char *header="", Option_t *option="")
Sets the header, which is the "title" that appears at the top of the legend.
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
void SetMargin(Float_t margin)
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetName() const
Returns name of object.
virtual void SetY1(Double_t y1)
Set the Y1 value.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void plot_training_history(TString dataset, TFile *file, TDirectory *BinDir=0)
void training_history(TString dataset, TString fin="TMVA.root", Bool_t useTMVAStyle=kTRUE)
Short_t Min(Short_t a, Short_t b)