Attempt to use TMVA in Windows

I’m trying to use TMVA with Windows and Python. The test program, TMVAnalysis.py, clearly was not designed to work with either, but loading sharebles is an easy fix. My problem is that after training the gaussian test data with boosted decision trees, it crashes with this output:
— BDT : average number of nodes before/after pruning : 295 / 83
— BDT : <Train_Prune> elapsed time: ←[0;31m19.3 sec←[0m
— BDT : creating weight file: ←[34mweights/MVAnalysis_BDT.weights.txt←[0m
Traceback (most recent call last):
File “”, line 1, in ?
Exception: unhandled, unknown C++ exception

factory.TestAllMethods()
— Factory : testing all methods…
— Factory : test method: BDT
— BDT : reading weight file: ←[34mweights/MVAnalysis_BDT.weights.txt←[0m

Thanks for any hints, (other than to use linux). (:slight_smile:
–Toby Burnett

Hi Tobby,

I have reported the problem to the authors.
TMVAnalysis.C works (except that you get a long silly output ::slight_smile:

Rene

Hi Toby,

I’m sorry for the inconvenience. We only recently introduced the python script, and apparently it was not properly tested on windows (we don’t have a test platform for that yet, but since there is demand we will extent our test bed). I’ll have a look into that and let you know. It might be that the latest version of TMVA - which is available on sourceforge - already solves the problem (however, we only supply the source code on sourceforge and leave it to the user to compile. We are working on that too, but we are no windows experts.)

In the meantime, could you please use the TMVAnalysis.C macro in the tmva/test directory?

Best regards,
Joerg

[quote=“thburnett”]I’m trying to use TMVA with Windows and Python. The test program, TMVAnalysis.py, clearly was not designed to work with either, but loading sharebles is an easy fix. My problem is that after training the gaussian test data with boosted decision trees, it crashes with this output:
— BDT : average number of nodes before/after pruning : 295 / 83
— BDT : <Train_Prune> elapsed time: ←[0;31m19.3 sec←[0m
— BDT : creating weight file: ←[34mweights/MVAnalysis_BDT.weights.txt←[0m
Traceback (most recent call last):
File “”, line 1, in ?
Exception: unhandled, unknown C++ exception

factory.TestAllMethods()
— Factory : testing all methods…
— Factory : test method: BDT
— BDT : reading weight file: ←[34mweights/MVAnalysis_BDT.weights.txt←[0m

Thanks for any hints, (other than to use linux). (:slight_smile:
–Toby Burnett[/quote]

Thanks for the reply. The problem with your python script, TMVAnalysis.py, is trivial, and easily fixed: gSystem.Load( ‘libTMVA.1.so’ ) should not have the “.so” to be compatible with both Linux and Windows. Since Python only calls the C++ code, just as the CINT script does, that cannot be a problem in itself. A problem (this is v5.14.00, BTW), is that the option strings are not correct for several of the classifiers, but for now I’m only interested in BDT. The bottom line is that I get the same result from executing the TMVA code itself, using TMVAnalysis.C with all but BDT turned off (forced by the option problem)

[quote]— BDT : ←[1;42m←[33m[←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0m←[1;4

←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0m←[
33m>←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0m←[1;42m←[33m>←[0
— BDT : average number of nodes before/after pruning : 295 / 84
— BDT : <Train_Prune> elapsed time: ←[0;31m19.2 sec←[0m
— BDT : creating weight file: ←[34mweights/MVAnalysis_BDT.weights.txt←[0m
Error: C++ exception caught D:\Users\burnett\TMVA\macros\TMVAnalysis.C(250)[/quote]

Apparently an I/O problem with creating the weight file.
Thanks.

Hi Toby,

thanks for solving the problem quickly. I just talked to Rene and he also told me about the lib extension. About the option string, we actually did a lot of changes to the way we configure the methods, and something was probably overlooked. If you are happy with the BDT only then this is fine, otherwise you could copy the option strings for the desired methods from the TMVAnalysis.C macro.

Thanks and Cheers,
Joerg

Hi, you may have misunderstood: I was not complaining about the python code, but the fact that TMVA crashed while writing the weight file.

So I found the problem, which is in the C++ code at MethodBase.cxx:455

In Windows, it seems that PWD is not defined, so a null is returned, and interpreted as a pointer to a string. I’d suggest using instead _getcwd() in the Windows case.

So the work-around is obvious, and I presume that Rene had that var defined when he tested the code.

The escape strings are not fatal, but rather annoying. Could you change the definitions of BC_blue etc., to empty strings for the Windows case? They are defined separately in MethodBase.cxx, Timer.cxx, and Tools. cxx.

Tobby, Joerg,

If you want to be portablle, replace the call to

gSystem>Getenv("PWD") by

gSystem->HomeDirectory()
Rene

I am using the most recent version of ROOT (5.15.06), but still I get the error from TMVA while writing the weights file to disk. This error has already been reported, and looks like Rene had already proposed a fix for it. Maybe it has not made it to this version yet…?

Thanks.
-Arun

In the CVS version, I have replaced the call to gSystem->GetEnv(“PWD”) by gSystem->WorkingDirectory(), such that it works on all systems.

Rene