28 TIter keys_dir =
file->GetDirectory(dataset.
Data())->GetListOfKeys();
31 while ((key = (
TKey *)keys_dir())) {
33 if (
name.BeginsWith(
"InputVariables_")) {
50 Int_t countCanvas = 0;
53 TIter next(
file->GetDirectory(dataset.
Data())->GetListOfKeys());
55 while ((key = (
TKey*)next())) {
67 while ((titkey = (
TKey*)keyIt())) {
69 if (!
gROOT->GetClass(titkey->
GetClassName())->InheritsFrom(
"TDirectory"))
continue;
75 cout <<
"--- Found directory for method: " << methodName <<
"::" << methodTitle << endl;
76 TString hname =
"MVA_" + methodTitle;
77 for(
UInt_t icls = 0; icls < classnames.size(); ++icls){
80 std::vector<TString>::iterator classiter = classnames.
begin();
81 for(; classiter!=classnames.end(); ++classiter){
83 +
"_prob_for_" + *classiter);
86 cout <<
":\t mva distribution not available (this is normal for Cut classifier)" << endl;
94 ((
TH1*)hists.
First())->SetTitle(
Form(
"TMVA response for classifier: %s", methodTitle.
Data() ));
98 TString ctitle = ((htype == kMVAType) ?
99 Form(
"TMVA response for class %s %s", classnames.at(icls).Data(),methodTitle.
Data()) :
100 Form(
"TMVA comparison for class %s %s", classnames.at(icls).Data(),methodTitle.
Data())) ;
102 c =
new TCanvas(
Form(
"canvas%d", countCanvas+1), ctitle,
113 if(((
TH1*)hists[i])->GetMaximum() > histmax)
114 histmax = ((
TH1*)hists[i])->GetMaximum();
121 Float_t maxMult = (htype == kCompareType) ? 1.3 : 1.2;
130 frame->
GetXaxis()->
SetTitle( methodTitle +
" response for "+classnames.at(icls));
137 c->GetPad(0)->SetLeftMargin( 0.105 );
141 TLegend *legend=
new TLegend(
c->GetLeftMargin(), 1 -
c->GetTopMargin() - 0.12,
142 c->GetLeftMargin() + (htype == kCompareType ? 0.40 : 0.3), 1 -
c->GetTopMargin() );
144 classiter = classnames.begin();
152 legend->
Draw(
"same");
157 ((
TH1*)hists[i])->Draw(
"histsame");
159 ((
TH1*)hists[i])->GetYaxis()->SetTitle( ytit );
164 if (htype == kCompareType) {
168 classiter = classnames.
begin();
169 for(; classiter!=classnames.end(); ++classiter){
171 +
"_prob_for_" + *classiter);
174 cout <<
":\t comparison histogram for overtraining check not available!" << endl;
180 TLegend *legend2=
new TLegend( 1 -
c->GetRightMargin() - 0.42, 1 -
c->GetTopMargin() - 0.12,
181 1 -
c->GetRightMargin(), 1 -
c->GetTopMargin() );
185 classiter = classnames.begin();
187 legend2->
AddEntry(((
TH1*)othists[i]),*classiter+
" (training sample)",
"P");
190 legend2->
Draw(
"same");
195 if(((
TH1*)othists[i])->GetMaximum() > histmax)
196 histmax = ((
TH1*)othists[i])->GetMaximum();
201 Int_t col = ((
TH1*)hists[i])->GetLineColor();
202 ((
TH1*)othists[i])->SetMarkerSize( 0.7 );
203 ((
TH1*)othists[i])->SetMarkerStyle( 20 );
204 ((
TH1*)othists[i])->SetMarkerColor( col );
205 ((
TH1*)othists[i])->SetLineWidth( 1 );
206 ((
TH1*)othists[i])->Draw(
"e1same");
209 ymax = histmax*maxMult;
215 ((
TH1*)hists[i])->SetLineWidth( 1 );
221 cout <<
"--- Perform Kolmogorov-Smirnov tests" << endl;
222 cout <<
"--- Goodness of consistency for class " << classnames.at(icls)<< endl;
225 Float_t kol = ((
TH1*)hists[j])->KolmogorovTest(((
TH1*)othists[j]),
"X");
226 cout << classnames.at(j) <<
": " << kol << endl;
239 frame->
Draw(
"sameaxis");
262 else if (htype == kCompareType)
TMVAGlob::imgconv(
c,
Form(
"%s/plots/overtrain_%s_%s",dataset.
Data(),classnames.at(icls).Data(), methodTitle.
Data()) );
include TDocParser_001 C image html pict1_TDocParser_001 png width
char * Form(const char *fmt,...)
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title Offset is a correction factor with respect to the "s...
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLimits(Double_t xmin, Double_t xmax)
Describe directory structure in memory.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual TList * GetListOfKeys() const
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
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 const char * GetClassName() const
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 Draw(Option_t *option="")
Draw this legend with its current attributes.
void SetMargin(Float_t margin)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetName() const
Returns name of object.
Int_t GetEntriesFast() const
TObject * First() const
Return the object in the first slot.
Mother of all ROOT objects.
virtual void SetBorderSize(Int_t bordersize=4)
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
std::string GetMethodName(TCppMethod_t)
void Initialize(Bool_t useTMVAStyle=kTRUE)
void GetMethodTitle(TString &name, TKey *ikey)
void plot_logo(Float_t v_scale=1.0, Float_t skew=1.0)
TFile * OpenFile(const TString &fin)
void SetFrameStyle(TH1 *frame, Float_t scale=1.0)
void SetMultiClassStyle(TObjArray *hists)
void NormalizeHist(TH1 *h)
std::vector< TString > GetClassNames(TDirectory *dir)
void imgconv(TCanvas *c, const TString &fname)
void mvasMulticlass(TString dataset, TString fin="TMVAMulticlass.root", HistType htype=kMVAType, Bool_t useTMVAStyle=kTRUE)