# Variable importances don't get printed when using CrossValidation

**URL:** <https://root-forum.cern.ch/t/variable-importances-dont-get-printed-when-using-crossvalidation/43238>\
**Category:** TMVA\
**Created:** [January 24, 2021, 12:47pm UTC](https://root-forum.cern.ch/t/variable-importances-dont-get-printed-when-using-crossvalidation/43238 "2021-01-24T12:47:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![avenkate](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@avenkate](https://root-forum.cern.ch/u/avenkate)\
**Post date:** [January 24, 2021, 12:47pm UTC](https://root-forum.cern.ch/t/variable-importances-dont-get-printed-when-using-crossvalidation/43238/1 "2021-01-24T12:47:53Z")

</div>

Dear experts,

I have noticed that the variable importances (both method unspecific and method specific) aren’t being printed out by TMVA when using CrossValidation. Is there a reason for this?

I have tried training both with and without `FoldFileOutput=True` in the CrossValidation constructor, and I don’t see the variable importances in either.

I am using ROOT 6.22.06 on lxplus, invoked by  
`source /cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.22.06/x86_64-centos7-gcc48-opt/bin/thisroot.sh`

Thanks,  
Arvind.

---

<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:** [January 25, 2021, 12:35pm UTC](https://root-forum.cern.ch/t/variable-importances-dont-get-printed-when-using-crossvalidation/43238/2 "2021-01-25T12:35:23Z")

</div>

Hi,

If I remember correctly this is because the variable importances are calculated on the training set and using k-folds cross-validation there is not a singular training set anymore. How to merge the importances from different model trained on different data is not straight forward (to my knowledge) and it was left out.

Just printing the importances for each individual fold and reporting them in the per-fold output should be possible but I would not be able to judge the difficulty of implementation. Maybe @moneta can provide some insight?

Cheers,  
Kim

---

<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:** [January 25, 2021, 3:20pm UTC](https://root-forum.cern.ch/t/variable-importances-dont-get-printed-when-using-crossvalidation/43238/3 "2021-01-25T15:20:22Z")

</div>

Hi,

I think it should not be difficult to add the printing of the variable ranking information for each fold when doing Cross Validation. If you think this it will be useful, can you please open an GitHub issue for this?  
Thank you

Lorenzo

---

<div class="post-metadata">

**Author:** ![avenkate](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@avenkate](https://root-forum.cern.ch/u/avenkate)\
**Post date:** [January 25, 2021, 3:28pm UTC](https://root-forum.cern.ch/t/variable-importances-dont-get-printed-when-using-crossvalidation/43238/4 "2021-01-25T15:28:42Z")

</div>

Done, [https://github.com/root-project/root/issues/7092](https://github.com/root-project/root/issues/7092)

Thanks!,  
Arvind.

---

<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:** [January 27, 2021, 11:35am UTC](https://root-forum.cern.ch/t/variable-importances-dont-get-printed-when-using-crossvalidation/43238/5 "2021-01-27T11:35:17Z")

</div>

Great, Thank you !!!
