TMVA Plot Roc Curve From Test-Points

Hi, I have a question about making a roc curve using TMVA. I have an array of the known weights of some events:

known_weights = [1, 1, -1, 1, -1 ...]

and what my BDTs in TMVA evaluated those events to:

tmva_eval = [0.8, 0.5, -0.3 ...]

Is there an easy way to plot a roc curve (similar to trainingRejBvsS from TMVA’s output file) from these arrays?

It looks like this
may be what I’m looking for, but it’s not clear which of my arrays would be mvaValues and which would be mvaWeights, and I have no idea what mvaTargets would be.

Thank you in advance.

The ROCCurve class can receive as input a vector for the MVA (e.g. BDT) evaluated values for both signal and background, mvaValues and a boolean vector for targets, mvaTargets ( false for background, true for signal events) and a weight vector mvaWeights.
Otherwise you can also pass as input separate vectors for signal values, background values, signal weight values and background weight values.

Hope it is clear now, if not I can provide you an example

Best regards


Hi Lorenzo, thank you for the quick reply!

So as I understand it, in my case, since +1 corresponds to signal and -1 to background I would convert the vector

known_weights = [1, 1, -1, 1, -1 ...]


mvaTargets = [True, True, False, True, False ...]

and leave tmva_eval as is, using that as mvaValues

What then would mvaWeights be?

Thank you!


mvaWeights are the single event weights, if you don’t have they are by default equal to 1. You can then use in that case the constructor without them,


Hi Lorenzo,

Thank you very much for the explanation!
I was unaware that each event could have an associated weight.