# TMVA on tuning hyper-parameters in Cross-Validation

**URL:** <https://root-forum.cern.ch/t/tmva-on-tuning-hyper-parameters-in-cross-validation/28846>\
**Category:** TMVA\
**Created:** [April 28, 2018, 10:01pm UTC](https://root-forum.cern.ch/t/tmva-on-tuning-hyper-parameters-in-cross-validation/28846 "2018-04-28T22:01:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hai\_Jiang1](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/e99b99/32.png) [@Hai\_Jiang1](https://root-forum.cern.ch/u/Hai_Jiang1)\
**Post date:** [April 28, 2018, 10:01pm UTC](https://root-forum.cern.ch/t/tmva-on-tuning-hyper-parameters-in-cross-validation/28846/1 "2018-04-28T22:01:21Z")

</div>

Dear all TMVA experts,

I have searched a lot on the automatic parameter tuning in the TMVA, and it’s said that in the following release:  
[https://root.cern.ch/doc/v608/release-notes.html](https://root.cern.ch/doc/v608/release-notes.html)

 ![WechatIMG1215](https://root-forum.cern.ch/uploads/default/original/3X/4/0/405dd2325b76053390f3d80e45df528d5a0284a4.jpeg)

The Hyper-Parameter tuning for BDT and SVM methods is added into the cross-validation file of TMVA.

But I have checked the codes:  
[https://root.cern/doc/master/TMVACrossValidation\_8C.html](https://root.cern/doc/master/TMVACrossValidation_8C.html)

It seems there is no tuning function for optimizing parameters values. Anyone knows how to apply the automatic tuning parameter in Cross-Validation in TMVA?

Many thanks!  
Hai

---

<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:** [May 1, 2018, 3:57pm UTC](https://root-forum.cern.ch/t/tmva-on-tuning-hyper-parameters-in-cross-validation/28846/2 "2018-05-01T15:57:27Z")

</div>

Hi,

There is, unfortunately, no tutorial yet for the Hyperparameter optimisation. The use is similar to that of cross validation.

Something along the line of:

```auto
auto * d = new TMVA::DataLoader("name");
// Set up dataloader
TMVA::HyperParameterOptimization h{d, ...);
h.BookMethod(...);
h.Evalutate();
h.Print();

```

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![Hai\_Jiang1](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/e99b99/32.png) [@Hai\_Jiang1](https://root-forum.cern.ch/u/Hai_Jiang1)\
**Post date:** [May 1, 2018, 4:44pm UTC](https://root-forum.cern.ch/t/tmva-on-tuning-hyper-parameters-in-cross-validation/28846/3 "2018-05-01T16:44:57Z")

</div>

Dear Kim,

Thanks! I have also found it in the raw codes:  
[https://root.cern/doc/master/HyperParameterOptimisation\_8cxx\_source.html](https://root.cern/doc/master/HyperParameterOptimisation_8cxx_source.html)

And this function is only implemented into few methods, mainly BDT and SVM. Also it takes very long time to grid search the optimal setup…Hope someone in the future can implement the random search or the Bayesian etc optimization and implement to all ml methods.

Kind regards,  
Hai
