ROC curves of methods of classification

Hello everyone, good evening

I am a beginner in ROOT and I try to analyze data on the income of adults in E.U. For being categorical variables I did a numeric equivalence, in particular, 1 if a person earn more of $50000 dollars annually and 2 if it doesn’t. I achieved to make neural networks (Thanks to my friend Xination) and decision trees with this. Now, I want to generate the ROC curve to compare the performance of these methods. I modified the code of TMVAClassification.C but I did not understand lines 216-223.
There is another way to generate ROC curves between these methods? Could you please give me a code example of that?

Thanks for your attention
Excuse my English mistakes and if you have any suggestions please tell me
Have a nice night

Karen D.

@kialbert @moneta could you help @KarenDmn with this one? Thank you.

Hi, Karen!

And welcome to TMVA! :slight_smile:

There are two ways to get a roc curve in TMVA. You can either get it through the TMVA Gui or you can get it as a graph through the Factory.

To use the TMVA Gui:

root -l -e 'TMVA::TMVAGui("<name/of/your/output/file>")'

Then press the button for ROC curve.

To get it from the Factory:

// After a standard set-up along the lines of:
TMVA::DataLoader d {"<datasetname>"};
TMVA::Factory f {"<jobname>", outputFile, "<options>"};
f.BookMethod(d, methodType, "<methodOptions>");

// You can do this:
TMultiGraph* rocgraph = f.GetROCCurveAsMultiGraph("<datasetname>");


Hi kialbert,

I added your line to my code and first I got an error “function not viable: requires 2 arguments, but 1 was provided TMultiGraph* GetROCCurveAsMultiGraph(DataLoader loader, UInt_t iClass);", then after read the TMVA::ROCCurve Class Reference online, I modified to "TMultiGraph rocgraph = factory->GetROCCurveAsMultiGraph(“wine.root”, 100);” and my macro runs, but I get “… Thanksfor using TMVA…*** Break *** segmentation violation”.

Could you please tell me what I am doing wrong?

Thanks, have a nice day
Karen :slight_smile:

Hi Karen,

I accidentally pointed you to the wrong function. The one I meant is the following. Do also note that the string "<datasetname>" should be the same as what is given to the dataloader constructor.

auto roc = factory->GetROCCurve("<datasetname>");


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.