# Error while running training macro for classification

**URL:** <https://root-forum.cern.ch/t/error-while-running-training-macro-for-classification/39909>\
**Category:** TMVA\
**Created:** [June 14, 2020, 8:46pm UTC](https://root-forum.cern.ch/t/error-while-running-training-macro-for-classification/39909 "2020-06-14T20:46:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saumyenk](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/3bc359/32.png) [@Saumyenk](https://root-forum.cern.ch/u/Saumyenk)\
**Post date:** [June 14, 2020, 8:46pm UTC](https://root-forum.cern.ch/t/error-while-running-training-macro-for-classification/39909/1 "2020-06-14T20:46:48Z")

</div>

Hi,  
I was trying to run classification macro (attached herewith) but getting errors that are very unexpected. Could anybody check the code if there’s anything wrong or not? Surely, there should be something wrong. Here, I am not calling the `dataloader` but only the `Factory`. Do you think that the `dataloader` has to be called? Here’s the snap of the errors I’m getting.

 ![Screenshot from 2020-06-15 02-00-36](https://root-forum.cern.ch/uploads/default/original/3X/7/a/7af8260da4f7542c90cc479cd7d010fbead6d4ce.png)

[Training\_Z\_SP.C](https://root-forum.cern.ch/uploads/short-url/qyQN0KgPwPAZegycbGvJRWIUm9A.C) (7.0 KB)

Regards,  
Saumyen

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [June 15, 2020, 6:23am UTC](https://root-forum.cern.ch/t/error-while-running-training-macro-for-classification/39909/2 "2020-06-15T06:23:16Z")

</div>

Maybe @moneta can take a look

---

<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:** [June 15, 2020, 8:22am UTC](https://root-forum.cern.ch/t/error-while-running-training-macro-for-classification/39909/3 "2020-06-15T08:22:24Z")

</div>

Hi,

Yes you should use the DataLoader class to add for example the variables you will need for classification. Please follow the tutorial example code `tutorials/tmva/TMVAClassification.C`, see  
[https://root.cern.ch/doc/v614/TMVAClassification\_8C.html](https://root.cern.ch/doc/v614/TMVAClassification_8C.html)

Lorenzo

---

<div class="post-metadata">

**Author:** ![Saumyenk](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/3bc359/32.png) [@Saumyenk](https://root-forum.cern.ch/u/Saumyenk)\
**Post date:** [June 15, 2020, 10:38am UTC](https://root-forum.cern.ch/t/error-while-running-training-macro-for-classification/39909/4 "2020-06-15T10:38:21Z")

</div>

Thanks a lot Lorenzo for the reply.  
Yes, I saw that macro and earlier I edited and used. But I was going through the manual of TMVA (even the latest one) and found no reference of `Dataloader` and things like input variables registration are being done using the `Factory`. So I was trying to write a simplified macro.  
Now it is running properly after calling the `Dataloader`.  
Thanks a lot.

Regards,  
Saumyen

---

<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:** [June 15, 2020, 11:35am UTC](https://root-forum.cern.ch/t/error-while-running-training-macro-for-classification/39909/5 "2020-06-15T11:35:49Z")

</div>

Hi Saumyen,  
Thank you for the feedback. We will then correct the TMVA manual  
best regards  
Lorenzo
