Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to TMVA API in new ROOT versions break TMVAClassifier #105

Open
fndari opened this issue Jul 16, 2017 · 1 comment
Open

Changes to TMVA API in new ROOT versions break TMVAClassifier #105

fndari opened this issue Jul 16, 2017 · 1 comment

Comments

@fndari
Copy link

fndari commented Jul 16, 2017

Hi all,

first of all, I wanted to thank and compliment the developers for this brilliant library. I finally had the chance to start playing with it today, but I was stopped in my tracks when trying to use a TMVAClassifier:

AssertionError: ERROR: TMVA process is incorrect finished 
 LOG: None 
 Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/ludo/miniconda3/envs/pyroot/lib/python2.7/site-packages/rep/estimators/_tmvaFactory.py", line 86, in main
    tmva_process(classifier, info, data, labels, sample_weight)
  File "/home/ludo/miniconda3/envs/pyroot/lib/python2.7/site-packages/rep/estimators/_tmvaFactory.py", line 40, in tmva_process
    factory.AddVariable(var)
AttributeError: 'Factory' object has no attribute 'AddVariable'

My ROOT/TMVA versions are:

You are running ROOT Version: 6.08/00, Nov 4, 2016
TMVA Version 4.2.1, Feb 5, 2015

Searching the web for this error message led me to this post on the ROOT forum: https://root-forum.cern.ch/t/25090, where the cause of problem is indicated as being due to a breaking change in the TMVA API:

In recent ROOT versions (6.06 or 6.08, don't remember exactly), the TMVA interface has changed. You need to create a TMVA::DataLoader and call AddVariable on the dataloader object.

As I understand, this is related to what was mentioned by @gandreassi in a comment to #104. Any idea on how complicated it would be to adapt tmva_process to the new interface?

@gandreassi
Copy link

Hi Ludovico,

this seems indeed the same problem that I encountered.
What I did to solve it is pretty simple: it consisted of modifying rep/estimators/_tmvaFactory.py
You need to adapt this to the new syntax of TMVA, which requires to create a DataLoader object and to use it in place of the factory itself in some places.
An example that I found on how to use the dataloader is available here:
https://root.cern/doc/master/TMVACrossValidation_8C.html

As I wrote in the thread that you quoted, I'd be happy to push my fix in a branch if the developers agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants