# TMVA problem in example script

**URL:** <https://root-forum.cern.ch/t/tmva-problem-in-example-script/13942>\
**Category:** TMVA\
**Created:** [March 8, 2012, 8:43pm UTC](https://root-forum.cern.ch/t/tmva-problem-in-example-script/13942 "2012-03-08T20:43:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![callampen](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/callampen/32/11155_2.png) [@callampen](https://root-forum.cern.ch/u/callampen)\
**Post date:** [March 8, 2012, 8:43pm UTC](https://root-forum.cern.ch/t/tmva-problem-in-example-script/13942/1 "2012-03-08T20:43:30Z")

</div>

Hi,

In the example script for TMVA ($(ROOTSYS)/tmva/test/TMVAClassification.C), I may have found a mistake…

I’m using the trunk of root as of a couple days ago.

Line 192 shows:

```auto
   factory->AddSpectator( "spec1 := var1*2", "Spectator 1", "units", 'F' );
   factory->AddSpectator( "spec2 := var1*3", "Spectator 2", "units", 'F' );
```

However, the definition for add spectator is:

```auto
void AddSpectator(const TString& expression, const TString& title = "", const TString& unit = "", Double_t min = 0, Double_t max = 0)
```

(and I see no other overloaded versions of the function on the html documentation at [http://root.cern.ch/root/html/TMVA\_\_Factory.html#TMVA\_\_Factory:AddSpectator](http://root.cern.ch/root/html/TMVA __Factory.html#TMVA__ Factory:AddSpectator))

So, ‘F’ is being passed to “min”. I assume its being casted from a char to a Double\_t when TMVAClassification.C is run as a macro. I discovered the problem by using the python version of the script, [TMVAClassification.py](http://TMVAClassification.py), which wouldn’t run.

So is the script wrong, or did an interafce function which takes a char as a 4th argument disapear?

---

<div class="post-metadata">

**Author:** ![callampen](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/callampen/32/11155_2.png) [@callampen](https://root-forum.cern.ch/u/callampen)\
**Post date:** [March 13, 2012, 10:13pm UTC](https://root-forum.cern.ch/t/tmva-problem-in-example-script/13942/2 "2012-03-13T22:13:41Z")

</div>

Another mistake in the python example file. The formulas for FDA\_MC through FDA\_MT have a typo where they are missing a semicolon in the parameter string. They say:

ParRanges=(-1,1)(-10,10);(-10,10);(-10,10);(-10,10)

The semicolon is missing between (-1,1) and (-10,10). See for example line 327 of:  
[root.cern.ch/viewvc/trunk/tmva/t … iew=markup](http://root.cern.ch/viewvc/trunk/tmva/test/TMVAClassification.py?revision=38475&view=markup)  
(revision 38475 of the trunk)

---

<div class="post-metadata">

**Author:** ![Nonnormalizable](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/nonnormalizable/32/11271_2.png) [@Nonnormalizable](https://root-forum.cern.ch/u/Nonnormalizable)\
**Post date:** [April 17, 2012, 9:27pm UTC](https://root-forum.cern.ch/t/tmva-problem-in-example-script/13942/3 "2012-04-17T21:27:22Z")

</div>

I confirm I see the same problem with AddSpectator in the PyROOT script. Deleting the last argument from [TMVAClassification.py](http://TMVAClassification.py) lines 161 and 162 seems to fix it for me.

This is TMVA 4.1.2 with root 5.32/01.

---

<div class="post-metadata">

**Author:** ![callampen](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/callampen/32/11155_2.png) [@callampen](https://root-forum.cern.ch/u/callampen)\
**Post date:** [April 17, 2012, 10:22pm UTC](https://root-forum.cern.ch/t/tmva-problem-in-example-script/13942/4 "2012-04-17T22:22:56Z")

</div>

Just to be clear, although the python script is where I found the problem, I think the C macro version is ALSO wrong. The difference is that the C macro is not complaining about the typecast from char to int, but python is. Both are incorrect.
