# Does the standalone C++ response class support cross validation?

**URL:** <https://root-forum.cern.ch/t/does-the-standalone-c-response-class-support-cross-validation/48069>\
**Category:** TMVA\
**Tags:** tmva\
**Created:** [December 15, 2021, 12:51pm UTC](https://root-forum.cern.ch/t/does-the-standalone-c-response-class-support-cross-validation/48069 "2021-12-15T12:51:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dongliang](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/e9c0ed/32.png) [@Dongliang](https://root-forum.cern.ch/u/Dongliang)\
**Post date:** [December 15, 2021, 12:51pm UTC](https://root-forum.cern.ch/t/does-the-standalone-c-response-class-support-cross-validation/48069/1 "2021-12-15T12:51:56Z")

</div>

Dear experts,  
I’m checking to see if I can use the standalone C++ response class code to apply a BDT trained using CrossValidation. In the TMVA tutorial scripts `TMVACrossValidation.C` and `TMVACrossValidationApplication.C`, if I understand correctly, the splitting of the subsets is using the `event_ID` variable. But when I read the generated C++ class code, I don’t see how this variable could be passed to the C++ class. So the question is: does the standalone C++ response class support cross validation?

I also see an example of applying the MVA using RReader in `tmva003_RReader.C`. Does RReader support cross validation?

Thanks!

---

<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:** [December 16, 2021, 10:12am UTC](https://root-forum.cern.ch/t/does-the-standalone-c-response-class-support-cross-validation/48069/2 "2021-12-16T10:12:48Z")

</div>

Hi,  
At the moment only the Reader class support deterministic cross validation, where you apply according to a split expression of a spectator variable the different trained models.  
In the case of standalone C++ code, you would need to split the data yourself and apply the corresponding saved models.  
For the RReader, also this is not supported yet, there is an open PR for supporting spectator variable, [[TMVA] RReader: allow spectators in xml file by goi42 · Pull Request #7899 · root-project/root · GitHub](https://github.com/root-project/root/pull/7899), and maybe it can be extended for cross evaluation.

Cheers

Lorenzo
