Getting the sensitivty and specificity array

Dear Experts,

Sorry for my ignorance. I want to plot the ROC curve manually for which I need the values of sensitivity and specificity array. Will you please help me to get them ?

It does not seems to be a ROOT specific question.


I am sorry. I am not very sure. I have installed ROOT 6.12.04 and tried running the example TMVAClassification.C . The GUI generated the ROC curve. I went inside the ROCCurve.cxx file and tried to change it. But didn’t help. That is why asked here.


We currently don’t have an easy way of getting those two. What you can do for analysis type classification is

TMVA::MethodBase *method = dynamic_cast<TMVA::MethodBase *>(this->GetMethod(datasetname, theMethodName));
TMVA::DataSet *dataset = method->Data();
TMVA::Results *results = dataset->GetResults(theMethodName, Types::kTesting, Types::kClassification);

TMVA::ROCCurve *rocCurve = nullptr;
std::vector<Float_t> *mvaRes = dynamic_cast<ResultsClassification *>(results)->GetValueVector();
std::vector<Bool_t> *mvaResTypes = dynamic_cast<ResultsClassification *>(results)->GetValueVectorTypes();
std::vector<Float_t> mvaResWeights;

auto eventCollection = dataset->GetEventCollection(Types::kTesting);
for (auto ev : eventCollection) {

rocCurve = new TMVA::ROCCurve(*mvaRes, *mvaResTypes, mvaResWeights);

And from rocCurve you can get the requested sensitivity and specificity.



Thank you so much for the reply. But unfortunately that didn’t work in my code. Should I put this directly to the code or to the ROCCurve .cxx file.

It should be put in your code.

Basically the idea is to get the vector of results from the method. To do this we need to get the dataset (where the input and output to/from methods are stored). We then need to convert the results to a format that the ROCCurve class understands and finally construct the ROCCurve.