mlpack / ensmallen

A header-only C++ library for numerical optimization --
http://ensmallen.org
Other
742 stars 120 forks source link

Adam with Decay #334

Closed shubham1206agra closed 2 years ago

shubham1206agra commented 2 years ago

I just want to ask that if I want to use weight decay with Adam. How should I proceed with it? As there is no parameter for weight decay in Adam optimizer.

zoq commented 2 years ago

At this point you would have to use the SGD class as basis:

CustomDecay decay;
SGD<AdamUpdate, MyDecay> optimizer(0.01, 32, 100000, 1e-5, true, decay);

and the CustomDecay class has to implement the following interface: https://github.com/mlpack/ensmallen/blob/master/include/ensmallen_bits/sgd/decay_policies/no_decay.hpp

Ideally, the adam optimizer can use the decay policy directly, instead of going over the SGD base class.

mlpack-bot[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! :+1: