I’m doing TMVA by following the tutorial macro named TMVAClassification.C:
I saw that the ROC expressed with 99 points from 0 to 1 in the output of TMVA.
I want to increase the granularity of ROC instead of using default setting.
Could someone guide me how can I do this?
Unfortunately I noticed that the function TMVA::Factory::GetROCCurve is missing a parameter specifying the number of points (the default is 100).
I will add this option. As a workaround the solution is to create the ROC curve from the TMVA output fil.
Here is an example on how to do from the outputfile of TMVAClassification.C for the BDT method.
TFile f("TMVA.root");
auto TestTree = (TTree*) f.Get("dataset/TestTree");
// retrieve from the Testing tree the mva output plus weight and class id
int n = TestTree->Draw("BDT:weight:classID","");
// fill vector for the 3 quantities
std::vector<float> mvas(TestTree->GetV1(), TestTree->GetV1()+n);
std::vector<float> weights(TestTree->GetV2(), TestTree->GetV2()+n);
std::vector<bool> targets(TestTree->GetV3(), TestTree->GetV3()+n);
// classID ==0 is signal , instead for ROC target==1 is considered signal
// need to flip boolean vector
targets.flip();
TMVA::ROCCurve roc( mvas, targets,weights);
// get a graph given number of points (e.g. 1000)
auto curve = roc.GetROCCurve(1000);
curve->Draw();
When I tried this macro, everything was fine except the last line.
It opens a canvas, however, the ROC curve is not appear.
I’ve checked that three vectors were filled with proper values.
Can you please give some help?
I’m using ROOT v6.22.02 with ubuntu20 - gcc9.3 binary distribution.
I just got the ROC curve by changing the following command line: TMVA::ROCCurve roc(mvas, targets, weights);
to TMVA::ROCCurve *roc = new TMVA::ROCCurve(mvas, targets, weights);