12 void TMVA::BoostControlPlots(TString dataset, TString fin , Bool_t useTMVAStyle )
15 TMVAGlob::Initialize( useTMVAStyle );
18 TFile* file = TMVAGlob::OpenFile( fin );
22 TString dirname=
"Method_Boost";
23 UInt_t ninst = TMVA::TMVAGlob::GetListOfTitles(dirname,titles,file->GetDirectory(dataset.Data()));
25 cout <<
"Could not locate directory 'Method_Boost' in file " << fin << endl;
29 TIter keyIter(&titles);
32 while ((key = TMVAGlob::NextKey(keyIter,
"TDirectory"))) {
33 boostdir = (TDirectory *)key->ReadObj();
34 boostcontrolplots(dataset, boostdir );
38 void TMVA::boostcontrolplots(TString dataset, TDirectory *boostdir ) {
40 const Int_t nPlots = 6;
45 const TString titName = boostdir->GetName();
46 sprintf( cn,
"cv_%s", titName.Data() );
47 TCanvas *c =
new TCanvas( cn, Form(
"%s Control Plots", titName.Data() ),
54 TString hname[nPlots]={
"BoostWeight",
"MethodWeight",
"ErrFraction",
"SoverBtotal",
"SeparationGain",
"SeparationGain"};
59 for (Int_t i=0; i<nPlots; i++){
61 TH1 *h = (TH1*) boostdir->Get(hname[i]);
62 TString plotname = h->GetName();
63 h->SetMaximum(h->GetMaximum()*1.3);
65 h->SetMarkerColor(color);
66 h->SetMarkerSize( 0.7 );
67 h->SetMarkerStyle( 24 );
69 h->SetLineColor(color);
76 TString hname_roctest[2] ={
"ROCIntegral_test",
"ROCIntegralBoosted_test"};
77 TString hname_roctrain[2]={
"ROCIntegral_train",
"ROCIntegralBoosted_train"};
78 TString htitle[2] = {
"ROC integral of single classifier",
"ROC integral of boosted method"};
80 for (Int_t i=0; i<2; i++){
82 TPad * cPad = (TPad*)c->cd(nPlots+i+1);
83 TH1 *htest = (TH1*) boostdir->Get(hname_roctest[i]);
84 TH1 *htrain = (TH1*) boostdir->Get(hname_roctrain[i]);
88 Bool_t histFilled = (htest && htrain);
90 if (!htest) htest =
new TH1F(
"htest",
"",2,0,1);
91 if (!htrain) htrain =
new TH1F(
"htrain",
"",2,0,1);
93 htest->SetTitle(htitle[i]);
94 htest->SetMaximum(1.0);
95 htest->SetMinimum(0.0);
96 htest->SetMarkerColor(color);
97 htest->SetMarkerSize( 0.7 );
98 htest->SetMarkerStyle( 24 );
99 htest->SetLineWidth(2);
100 htest->SetLineColor(color);
102 htrain->SetMaximum(1.0);
103 htrain->SetMinimum(0.0);
104 htrain->SetMarkerColor(color-2);
105 htrain->SetMarkerSize( 0.7 );
106 htrain->SetMarkerStyle( 24 );
107 htrain->SetLineWidth(2);
108 htrain->SetLineColor(color-2);
109 htrain->Draw(
"same");
112 TLegend *legend=
new TLegend( cPad->GetLeftMargin(),
113 0.2 + cPad->GetBottomMargin(),
114 cPad->GetLeftMargin() + 0.6,
115 cPad->GetBottomMargin() );
116 legend->AddEntry(htest, TString(
"testing sample"),
"L");
117 legend->AddEntry(htrain, TString(
"training sample (orig. weights)"),
"L");
118 legend->SetFillStyle( 1 );
119 legend->SetBorderSize(1);
120 legend->SetMargin( 0.3 );
121 legend->Draw(
"same");
124 TText* t =
new TText();
125 t->SetTextSize( 0.056 );
126 t->SetTextColor( 2 );
127 t->DrawTextNDC( .2, 0.6,
"Use MethodBoost option: \"Boost_DetailedMonitoring\" " );
128 t->DrawTextNDC( .2, 0.51,
"to fill this histograms" );
135 TString fname = dataset+Form(
"/plots/%s_ControlPlots", titName.Data() );
136 TMVAGlob::imgconv( c, fname );