# ROC curves of methods of classification

**URL:** <https://root-forum.cern.ch/t/roc-curves-of-methods-of-classification/28056>\
**Category:** TMVA\
**Created:** [February 23, 2018, 7:30am UTC](https://root-forum.cern.ch/t/roc-curves-of-methods-of-classification/28056 "2018-02-23T07:30:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![KarenDmn](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/a9a28c/32.png) [@KarenDmn](https://root-forum.cern.ch/u/KarenDmn)\
**Post date:** [February 23, 2018, 7:30am UTC](https://root-forum.cern.ch/t/roc-curves-of-methods-of-classification/28056/1 "2018-02-23T07:30:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [February 23, 2018, 11:13am UTC](https://root-forum.cern.ch/t/roc-curves-of-methods-of-classification/28056/2 "2018-02-23T11:13:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [February 23, 2018, 11:58am UTC](https://root-forum.cern.ch/t/roc-curves-of-methods-of-classification/28056/3 "2018-02-23T11:58:11Z")

</div>

Hi, Karen!

And welcome to TMVA! 🙂

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:

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

```

Then press the button for ROC curve.

To get it from the Factory:

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

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

```

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![KarenDmn](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/a9a28c/32.png) [@KarenDmn](https://root-forum.cern.ch/u/KarenDmn)\
**Post date:** [March 2, 2018, 9:29pm UTC](https://root-forum.cern.ch/t/roc-curves-of-methods-of-classification/28056/4 "2018-03-02T21:29:35Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [March 5, 2018, 2:03pm UTC](https://root-forum.cern.ch/t/roc-curves-of-methods-of-classification/28056/5 "2018-03-05T14:03:51Z")

</div>

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
auto roc = factory->GetROCCurve("<datasetname>");
roc->Draw();

```

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [March 19, 2018, 2:04pm UTC](https://root-forum.cern.ch/t/roc-curves-of-methods-of-classification/28056/6 "2018-03-19T14:04:05Z")

</div>

Closed on March 19, 2018, 2:04pm UTC

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