# Setting ADAM optimizer parameters

**URL:** <https://root-forum.cern.ch/t/setting-adam-optimizer-parameters/43450>\
**Category:** TMVA\
**Created:** [February 8, 2021, 6:15pm UTC](https://root-forum.cern.ch/t/setting-adam-optimizer-parameters/43450 "2021-02-08T18:15:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucas-NL](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/lucas-nl/32/24800_2.png) [@Lucas-NL](https://root-forum.cern.ch/u/Lucas-NL)\
**Post date:** [February 8, 2021, 6:15pm UTC](https://root-forum.cern.ch/t/setting-adam-optimizer-parameters/43450/1 "2021-02-08T18:15:59Z")

</div>

Dear all,  
I started working with TMVA’s DNN (DL) recently and I would like to compare some results my group had previously using sklearn library in python. For this, I would like to set as many parameters as possible the same we had in python, including the configurations of the ADAM optimizer. Still, I couldn’t find if it’s possible to change the “beta1”, “beta2” and “epsilon” from their [default values](https://root.cern/doc/v620/classTMVA_1_1DNN_1_1TAdam.html#abe9a714fb2066b7e9418939e5b5af3d9) (actually only the epsilon must be changed).  
Could you confirm if that is possible? I’m using ROOT V6.20.

Thanks in advance.

---

<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:** [February 8, 2021, 6:28pm UTC](https://root-forum.cern.ch/t/setting-adam-optimizer-parameters/43450/2 "2021-02-08T18:28:50Z")

</div>

Hi,  
It is possible to change from the MethodDL configuration string only the learning rate and unfortunatly not teh other parameters (beta1,beta2 and epsilon). The other parameters are fixed to their default values as shown in the above link. It is very easy to patch the code and changes, it is when the TAdam class is constructed, see [root/MethodDL.cxx at d935aa24289524f35e9359a7f48e6694ed4227dc · root-project/root · GitHub](https://github.com/root-project/root/blob/d935aa24289524f35e9359a7f48e6694ed4227dc/tmva/tmva/src/MethodDL.cxx#L1346)

If you need I can easily add a PR implementing this option.

Lorenzo

---

<div class="post-metadata">

**Author:** ![Lucas-NL](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/lucas-nl/32/24800_2.png) [@Lucas-NL](https://root-forum.cern.ch/u/Lucas-NL)\
**Post date:** [February 8, 2021, 10:09pm UTC](https://root-forum.cern.ch/t/setting-adam-optimizer-parameters/43450/3 "2021-02-08T22:09:57Z")

</div>

Sorry the delay.  
Indeed, if you could, that would be great!  
Thanks for the fast response and for your time. 😄

---

<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:** [March 1, 2021, 3:25pm UTC](https://root-forum.cern.ch/t/setting-adam-optimizer-parameters/43450/4 "2021-03-01T15:25:55Z")

</div>

A PR is now open adding this feature, see [[TMVA] Add capability to pass optimizer options in training string for MethodDL. by lmoneta · Pull Request #7318 · root-project/root · GitHub](https://github.com/root-project/root/pull/7318)
