# Using the HyperparameterOptimisation

**URL:** <https://root-forum.cern.ch/t/using-the-hyperparameteroptimisation/54814>\
**Category:** TMVA\
**Created:** [May 11, 2023, 9:56am UTC](https://root-forum.cern.ch/t/using-the-hyperparameteroptimisation/54814 "2023-05-11T09:56:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emil\_R](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/emil_r/32/31255_2.png) [@Emil\_R](https://root-forum.cern.ch/u/Emil_R)\
**Post date:** [May 11, 2023, 9:56am UTC](https://root-forum.cern.ch/t/using-the-hyperparameteroptimisation/54814/1 "2023-05-11T09:56:54Z")

</div>

Hi experts,  
I am trying to do a hyper parameter optimization, but sadly I am not quite understanding the documentation. I have made a DataLoader and now tried to book a method the following way:

```auto
TMVA::HyperParameterOptimisation optim(dataloader);

    TStopwatch tw;

    optim.BookMethod(TMVA::Types::kMLP, "MLP",
                     "H:!V:NeuronType=tanh:VarTransform=N:NCycles=600:HiddenLayers=N+5:TestRate=5");

    optim.SetFitter("Minuit");
    optim.SetNumFolds(5);
    optim.SetVerbose(1);

```

This works fine, but does not optimize anything. What I would like to have is variable number of Cycles, Layers (and maybe nodes) and Learning Rate, so that for each combination the performance is evaluated and I can afterwards chose the best method available. How can I book the method such that the Optimization knows which variables to tune?  
Thanks,  
Emil

---

<div class="post-metadata">

**Author:** ![mczurylo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mczurylo/32/33269_2.png) [@mczurylo](https://root-forum.cern.ch/u/mczurylo)\
**Post date:** [May 11, 2023, 2:53pm UTC](https://root-forum.cern.ch/t/using-the-hyperparameteroptimisation/54814/2 "2023-05-11T14:53:55Z")

</div>

Hi @Emil_R,

thank you for your question, Maybe @moneta could take a look?

Cheers,  
Marta

---

<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 2, 2023, 3:27pm UTC](https://root-forum.cern.ch/t/using-the-hyperparameteroptimisation/54814/3 "2023-06-02T15:27:02Z")

</div>

Hi,  
Apologies for the late reply. The HyperParameterOptimization works at the moment only on the TMVA methods impelmenting the function `TMVA::MethodBase::OptimizeTuningParameters`.  
Currently this is happening only for `BDT` and SVM methods and not MLP.  
If you would like to have it for MLP, please open a GitHub issue and we might find the time to do it  
Thank you

Lorenzo
