Signal and background from the output MVA

Hello root family,

I’m working with the tmva, I already did a Tmvaclassification and a tmvaclassificationApplication, and I saved the output of the TMVAClassificationApplication in a Branch, now I want to access to the number of background and signal in this MVA outputs, with the objective to do a figure of merit.

This is my output of the TMVAClassificationApplication with the method BDT

So my question is how to access to this number of signal and background to make this figure of merit (# events signal/ # events background) ?

TMVAClassificationApplication does not have the information on signal and background type. You pass an input event and it just performs the evaluation of your machine learning model.
If you know the true nature of the event you need to store that information (e.g. the classID) and add in your TTree.

On the other hand, TMVAClassification knows about signal and background events and its outputs (Testing and Training trees) contain the classID of the event.

Lorenzo

My idea was made a figure of merit with that output, but now I do not know If that is possible.

Now If I can’t do the first idea, I want to ask how to do manually the figure of merit, like they said in the part of changing the metric

“(by using the Application interface to get the raw output values and calculating your metric from there).”
I’m confused with this part

Hi,
You can do this on a data set where you have the label information (e.g. what is signal and what is background).
What is missing in the post above, is that you don\t need to run the application interface to change the metrics. You can run this and remake the efficiency plot with a different formula directly using the output file form the classification.
You need to run the GUI function mvaeffs() on the TMVA output file.

Lorenzo

One last question, I realized that I’m a little confused with the output of the Classification, so my question is what is the real meaning of that output

and thanks for answering all my questions

Hi,
The output of the classification is a ROOT file, which is provided as input when creating the Factory object, see the TMCAClassification.C tutorial. There the output file is called TMVA.root.
The output file contains a TTree for the training events and a TTree for the test events, which are used to validate and test the trained classifier. From that TTree you have all the information to compute the metrics. For example you can call from the ROOT prompt to make the plot for the Punzi metric with a= 3-sigma:

TMVA::mvaeffs("dataset","TMVA.root",1000,1000,true,"(S/1000)/(3./2+sqrt(B))")

Lorenzo