Home | News | Documentation | Download

TMVA Get Single Decision Tree From Forest

Hello,

For a very specific application of boosted decision trees, I would like to, after training my classifier with many trees, evaluate an event with a single one of those trees. I have found no method built into TMVA to do this (for good reason, I can’t imagine anyone wanting to do this outside of my project).

I see that in line 2353 of MethodBDT.cxx, the way this is done is through

fForest[itree]->CheckEvent(ev,fUseYesNoLeaf)

This will work for me. My question then is how, given the xml weights file from my BDT, can I get the fForest vector so I can get a single tree object to do this to?

Thank you!

I think @moneta can most probably help you

Hi,

You should be able to call the MethodBDT::GetForest() function, which will return `fForest, a vector with all the trees.

To get the MethodBDT object, if you have an XML file you can use the function Reader::BookMVA

Lorenzo

Hi Lorenzo,

Thank you very much, this is exactly what I needed and works perfectly!

Best,
Steve