Problem w/ (Py)TMVA std output in ROOT v6.14.04

Hello,

I am developing a Python (3) package to manage inputs and booking of different MVA suites and methods etc.

I am seeing a problem with the TMVA stdout, namely it doesn’t get printed out to screen even if the proper options of the TMVA factory and method objects seem to be set correctly.

This is a bit unfortunate, as I don’t know of another way of getting important info such as variable ranking other than looking at the std out (if there are, please tell me!).

Here’s a link to my package, with instructions on how to install it locally (NB: requires Python3.6+ and ROOT v6.14.04) and try to run TMVA on two sample files, also included. Look at README.rst

(approx size 120 MB)
https://cernbox.cern.ch/index.php/s/ZAwKdiVy4NaMteI

Many thanks for the help.

Cheers,
Marco

Hi Marco,

One thing I can see that could possibly interfere is that you silence all logging up to warning. A lot of TMVA information is printed at the info level and could be suppressed by this.

Otherwise, the TMVA output should end up in the stdout output stream.

Another thing, I would love to hear about your experience with the tmva cross validation interface.

Cheers,
Kim

Hi Kim,

I tried to comment out the ROOT msg suppression calls, but the problem is still there.

I have found a hack to force the output to be produced though: I noticed that w/ my code configuration, the only TMVA output messages that get printed are the ones in https://github.com/root-project/root/blob/v6-14-04/tmva/tmva/src/Factory.cxx#L2018

So, I have added the following two calls before the training routine of the factory is invoked:

def train(self):

   self.factory.Log().EnableOutput()
   ROOT.TMVA.gConfig().SetSilent(False)

   self.factory.TrainAllMethods()

et voila’, the output is there! Now the question is: why was it necessary? I am very puzzled…

On a different note, are the calls to:

TMVA.Tools.Instance()
TMVA.PyMethodBase.PyInitialize()

needed at all? I found them in the tutorial for Keras classification: https://github.com/root-project/root/blob/v6-14-04/tutorials/tmva/keras/ClassificationKeras.py#L12

Hi,

Glad you found a solution. That should not be neccessary. My suspicion is that there is some call somewhere that suppresses the output and the solution you present forces a re-enable.

On the different note: I think the calls can be removed. The PyInitialize should be called automatically when needed as a method from PyMVA is created. Likewise for the tools singleton object, it should also be created as needed.

Maybe @swunsch can give some more insight in the PyInitialize situation.

Cheers,
Kim

Hi Marco, hi Kim,

Up to now, the call TMVA.PyMethodBase.PyInitialize() is needed because the PyMVA library is loaded just on demand. If you don’t invoke this first, the PyMVA methods won’t be found by the factory, e.g., the PyKeras method is not “in the list of methods”.

Best
Stefan

1 Like