# TMlpANN broken in recent ROOT versions?

**URL:** <https://root-forum.cern.ch/t/tmlpann-broken-in-recent-root-versions/32867>\
**Category:** TMVA\
**Created:** [February 22, 2019, 4:53pm UTC](https://root-forum.cern.ch/t/tmlpann-broken-in-recent-root-versions/32867 "2019-02-22T16:53:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yoann](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/5fc32e/32.png) [@Yoann](https://root-forum.cern.ch/u/Yoann)\
**Post date:** [February 22, 2019, 4:53pm UTC](https://root-forum.cern.ch/t/tmlpann-broken-in-recent-root-versions/32867/1 "2019-02-22T16:53:03Z")

</div>

Dear TMVAers,

I recently upgraded from ROOT-6.05.02 to ROOT-6.14.06.  
I observed that after a successful training using the _TMlpANN_ algorithm, the classification application, performed using _reader-\>BookMVA(“TMlpANN”,weight\_file)_ and _reader-\>EvaluateMVA(“TMlpANN”)_, returns me for all events 1.80e-308.  
Doing exactly the same with the “MLP” algo works fine…

Therefore, I ran the tmva/tutorials (root -l TMVAClassification.C(“TMlpANN,MLP”) and TMVAClassificationApplication.C(“TMlpANN,MLP”)) and could reproduce this behavior:

- TMlpANN training go through and the ROC curve is fine
- good classifiers returned with ROOT-6.04.10 and ROOT-6.05.02 by the classification application.
- NULL TMlpANN classifiers returned by _reader-\>Evaluate()_ for recent versions \> ROOT-6.14.xx

Do you experience the same issue while running the tmva tutorials?  
If yes, do you have any understanding?

Cheers,  
Yoann

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [February 26, 2019, 9:28am UTC](https://root-forum.cern.ch/t/tmlpann-broken-in-recent-root-versions/32867/2 "2019-02-26T09:28:48Z")

</div>

Hi,

I can reproduce the problems in fairly recent version of the master branch. I’ll file a bug report and we’ll look into it as soon as possible.

You can follow it here: [https://sft.its.cern.ch/jira/browse/ROOT-9991](https://sft.its.cern.ch/jira/browse/ROOT-9991)

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![Yoann](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/5fc32e/32.png) [@Yoann](https://root-forum.cern.ch/u/Yoann)\
**Post date:** [March 18, 2019, 9:01am UTC](https://root-forum.cern.ch/t/tmlpann-broken-in-recent-root-versions/32867/3 "2019-03-18T09:01:19Z")

</div>

Dear Kim,

Is there any update from your side concerning the issue raised here?  
Sounds like I also get the same issue with freshly installed ROOT-6.04.10 (on recent Scientific Linux 7.4) but not with old ROOT-6.04.10 install (installed on Scientific Linux 7.1).

Cheers,  
Yoann

---

<div class="post-metadata">

**Author:** ![Yoann](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/5fc32e/32.png) [@Yoann](https://root-forum.cern.ch/u/Yoann)\
**Post date:** [April 30, 2019, 2:35pm UTC](https://root-forum.cern.ch/t/tmlpann-broken-in-recent-root-versions/32867/4 "2019-04-30T14:35:42Z")

</div>

Dear TMVAers,

I found a bug in TMVA, specific to the TMlpANN algorithm as far as I understand, related to the definition of the temporary weighting file location.  
In ROOT 6.14.06 for example:

- in `./tmva/tmva/src/MethodTMlpANN.cxx` - l. 361

```auto
// dump weights first in temporary txt file, read from there into xml
   const TString tmpfile=GetWeightFileDir()+"/TMlp.nn.weights.temp";

```

but `GetWeightFileDir()` points to nothing as it is never defined. Hence, this temporary file is tentatively created under the root directory “`/`” which cannot be done on most servers with non-admin rights.

One way for me to circumvent it has been to set a default value to the current directory:

- in `./tmva/tmva/src/MethodTMlpANN.cxx` - `TMVA::MethodBase::MethodBase()` creator

```auto
   SetWeightFileDir("."); // lines 298 & 362

```

Now, with this fix, I can see the temporary file `TMlp.nn.weights.temp` is created under the current directory.  
The weights are well loaded and the Classification Application is returning the expected classifiers (tested on ROOT 6.12.06 and 6.14.06).

To my understanding, this fix should be included together with the possibility to set this weight file directory at the `Reader` initialization level.

Cheers,  
Yoann

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [April 30, 2019, 2:55pm UTC](https://root-forum.cern.ch/t/tmlpann-broken-in-recent-root-versions/32867/5 "2019-04-30T14:55:26Z")

</div>

Hi,

Thank you Yoann for looking into this. This should make it more simple to land a fix. I will update the Jira ticket accordingly.

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![Yoann](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/5fc32e/32.png) [@Yoann](https://root-forum.cern.ch/u/Yoann)\
**Post date:** [April 30, 2019, 5:28pm UTC](https://root-forum.cern.ch/t/tmlpann-broken-in-recent-root-versions/32867/6 "2019-04-30T17:28:45Z")

</div>

Dear Kim,

Thanks.  
For the record, this temporary weight file location was set in older ROOT version (e.g. 6.05.02) in the `MethodBase` constructor with the following command:  
`SetWeightFileDir( gConfig().GetIONames().fWeightFileDir ); // line 190`

which, as a consequence, tentatively creates the default `./weights/` directory.  
In general, this is no problem except if creating a directory is not permitted by the users, hence my comment with ROOT-6.04.10

Cheers,  
Yoann
