# Using a larger sample size, TMVA appears to crash at TMVA:: Factory::TestAllMethods()

**URL:** <https://root-forum.cern.ch/t/using-a-larger-sample-size-tmva-appears-to-crash-at-tmva-factory-testallmethods/38471>\
**Category:** TMVA\
**Created:** [March 18, 2020, 8:17pm UTC](https://root-forum.cern.ch/t/using-a-larger-sample-size-tmva-appears-to-crash-at-tmva-factory-testallmethods/38471 "2020-03-18T20:17:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [March 18, 2020, 8:17pm UTC](https://root-forum.cern.ch/t/using-a-larger-sample-size-tmva-appears-to-crash-at-tmva-factory-testallmethods/38471/1 "2020-03-18T20:17:09Z")

</div>

Hello,

The following macro  
[trainKLCoeffsWithImpulsivityAndLinPolFracResponsesSemiweighted.C](https://root-forum.cern.ch/uploads/short-url/qVftvtzgzM9ee23t6bSHhTNJgOS.C) (17.6 KB)  
ran to completion when I ran it, but when I scaled it up to a data set that was 10x larger using  
[trainKLCoeffsFullResponsesSemiweighted.C](https://root-forum.cern.ch/uploads/short-url/ksuPW0ZIZlPF1Kpfp9D0UBhWW0k.C) (12.2 KB)  
it appeared to crash at the TMVA:: Factory ::TestAllMethods() step, after the first training. The output I got was  
[trainKLCoeffsFullResponsesSemiweighted0.txt](https://root-forum.cern.ch/uploads/short-url/3YH5L6Hv3mPCi4VmUJJCzvdOhBH.txt) (31.8 KB)  
My first suspicion is that this could be related to the TMVA::Factory objects being dynamically allocated as opposed to statically, so I have modified the above macro in the following way  
[trainKLCoeffsFullResponsesSemiweightedStatic.C](https://root-forum.cern.ch/uploads/short-url/oYhQCIIruj1YVllSjidb72MsjT9.C) (12.4 KB)

I am waiting to see if this resolves the issue. I will report back whether or not this resolves it, but any feedback before or after the macro ends would be appreciated.

---

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [March 19, 2020, 3:27am UTC](https://root-forum.cern.ch/t/using-a-larger-sample-size-tmva-appears-to-crash-at-tmva-factory-testallmethods/38471/2 "2020-03-19T03:27:10Z")

</div>

So it crashed at the same area as before.

I am now looking into statically allocating DataLoader objects, using DataLoaderCopy() instead of MakeCopy(). Below is the updated version.

[trainKLCoeffsFullResponsesSemiweightedStatic.C](https://root-forum.cern.ch/uploads/short-url/bTINXXog9UaxA1rVvilvxnoNbxS.C) (12.2 KB)

I will update as to whether or not this resolves the issue.

---

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [March 19, 2020, 10:31am UTC](https://root-forum.cern.ch/t/using-a-larger-sample-size-tmva-appears-to-crash-at-tmva-factory-testallmethods/38471/3 "2020-03-19T10:31:36Z")

</div>

Unfortunately, it did not.  
[trainKLCoeffsFullResponsesSemiweightedStatic.txt](https://root-forum.cern.ch/uploads/short-url/vdldw342CuWQiwosjIfqPm9SyYx.txt) (31.8 KB)

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 20, 2020, 2:18pm UTC](https://root-forum.cern.ch/t/using-a-larger-sample-size-tmva-appears-to-crash-at-tmva-factory-testallmethods/38471/4 "2020-03-20T14:18:27Z")

</div>

Hi,

Can you share also your ROOT files so one can run the macro and reproduce the problem.  
Probably you can try run it with the minimal amount of data needed

Lorenzo

---

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [March 21, 2020, 3:38am UTC](https://root-forum.cern.ch/t/using-a-larger-sample-size-tmva-appears-to-crash-at-tmva-factory-testallmethods/38471/5 "2020-03-21T03:38:38Z")

</div>

Hi Lorenzo,

Thank you for the reply. The files used are all rather large, ranging on the order of tens of MB to tens of GB. I am able to run the macro with files corresponding to decimated samples of these larger files. This is something I meant to suggest through this post’s title.

As not everything is being used in these files, it makes me think that a possible workaround could be to create files which copy over only the variables being used?

What I will try and do here is copy over and upload one of the smaller decimated files, on the off chance that the problem could be due to file structure.

[KLCoeffsOriginal-decimated-HiCal2A-part\_all\_1.root](https://root-forum.cern.ch/uploads/short-url/3LaXMYjZpZwIslFEFm1p9V6IEhX.root) (369.2 KB)

Unfortunately, the other type of file from which variables are pulled all appear to be too large to upload here, the smallest of these decimated files appears to be 4.2 MB.

If structure isn’t the problem, might I ask for a recommendation on how I can share the files in question? Files containing one set of variables total 34 G, while files containing the other set of variables total 642 G. The corresponding decimated versions of these file total 7.8 G and 119 G, respectively.

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 23, 2020, 9:48am UTC](https://root-forum.cern.ch/t/using-a-larger-sample-size-tmva-appears-to-crash-at-tmva-factory-testallmethods/38471/6 "2020-03-23T09:48:56Z")

</div>

Hi,  
I will check the structure of the file. Thank you for uploading this smaller one.

For sharing the large file, if you have a CERN account you could use cernbox, there a user should have a space of around 1TB.

I see also the crash is happening in the function `TTreeFormula::LoadCurrentDim()` that is called by  
`TTreeFormulaManager::GetNdata(bool) ` .  
Maybe @pcanal is having an idea what could be the problem

Lorenzo

---

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [March 24, 2020, 3:40am UTC](https://root-forum.cern.ch/t/using-a-larger-sample-size-tmva-appears-to-crash-at-tmva-factory-testallmethods/38471/7 "2020-03-24T03:40:38Z")

</div>

Hi Lorenzo,

Thank you for your reply. I don’t have a CERN account, but perhaps I could get one? How would I go about doing that?

I don’t know why I didn’t think of this before, but if file structure is the culprit, I can just attach here two even smaller sample files here.

[KLCoeffsOriginal-decimated-HiCal2A-part\_88.root](https://root-forum.cern.ch/uploads/short-url/xzJ8mGowaasOLEICbOVPwZggOSG.root) (25.3 KB)  
[summary-decimated-HiCal2A-part\_88-sinsub\_10\_3\_ad\_2.root](https://root-forum.cern.ch/uploads/short-url/m0wevuNwzFm1ZM3fuGacXYyfHTk.root) (373.6 KB)

The first of the files contains the first few entries of the file I already attached earlier. The other, larger, file contains other variables corresponding to these entries. Opening this other file, ROOT may complain about custom classes, but the file should be readable. If not, it should become readable after `git clone`ing the repository [https://github.com/anitaNeutrino/anitaBuildTool](https://github.com/anitaNeutrino/anitaBuildTool), and then running `./buildAnita.sh` from within the `anitaBuildTool` directory.

Best,  
John

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 24, 2020, 7:52am UTC](https://root-forum.cern.ch/t/using-a-larger-sample-size-tmva-appears-to-crash-at-tmva-factory-testallmethods/38471/8 "2020-03-24T07:52:59Z")

</div>

Thank you John, I will try with those file.  
For the CERN account, if you don’t have an association or collaboration with CERN, then it is unfortunatly not possible to get it. And I guess sharing tools like Google drive or dropbox don’t allow free sharing of such large files.  
I hope we can solve the problem looking at the small files.  
Best,

Lorenzo

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 24, 2020, 11:02am UTC](https://root-forum.cern.ch/t/using-a-larger-sample-size-tmva-appears-to-crash-at-tmva-factory-testallmethods/38471/9 "2020-03-24T11:02:00Z")

</div>

HI,  
Can you also post a version of the TMVA macro working with the two small sample file ?  
Thank you  
Lorenzo
