Dear ROOT experts,
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?
Thanks in advance,
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.
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
TMVA::ROCCurve roc( mvas, targets,weights);
// get a graph given number of points (e.g. 1000)
auto curve = roc.GetROCCurve(1000);
Thanks for your detailed answer with example!
I’ll try above example to draw ROC curve.
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.
curve->Draw("AP") doesn’t work either.
I also tried manually by making a canvas and add
c1->Update(); just after
The output is below.
Can you please post you code so I can reproduce this ?
Thanks for taking care of this issue.
You can get input of the code from here
high_granularity_roc.cpp (1.3 KB)
I just got the ROC curve by changing the following command line:
TMVA::ROCCurve roc(mvas, targets, weights);
TMVA::ROCCurve *roc = new TMVA::ROCCurve(mvas, targets, weights);