brainpy.optimizers.Adagrad#

class brainpy.optimizers.Adagrad(lr, train_vars=None, epsilon=1e-06, name=None)[source]#

Optimizer that implements the Adagrad algorithm.

Adagrad 3 is an optimizer with parameter-specific learning rates, which are adapted relative to how frequently a parameter gets updated during training. The more updates a parameter receives, the smaller the updates.

\[\theta_{t+1} = \theta_{t} - \dfrac{\eta}{\sqrt{G_{t} + \epsilon}} \odot g_{t}\]

where \(G(t)\) contains the sum of the squares of the past gradients

One of Adagrad’s main benefits is that it eliminates the need to manually tune the learning rate. Most implementations use a default value of 0.01 and leave it at that. Adagrad’s main weakness is its accumulation of the squared gradients in the denominator: Since every added term is positive, the accumulated sum keeps growing during training. This in turn causes the learning rate to shrink and eventually become infinitesimally small, at which point the algorithm is no longer able to acquire additional knowledge.

References

3

Duchi, J., Hazan, E., & Singer, Y. (2011). Adaptive Subgradient Methods for Online Learning and Stochastic Optimization. Journal of Machine Learning Research, 12, 2121–2159. Retrieved from http://jmlr.org/papers/v12/duchi11a.html

__init__(lr, train_vars=None, epsilon=1e-06, name=None)[source]#

Methods

__init__(lr[, train_vars, epsilon, name])

check_grads(grads)

load_states(filename[, verbose])

Load the model states.

nodes([method, level, include_self])

Collect all children nodes.

register_implicit_nodes(nodes)

register_implicit_vars(variables)

register_vars([train_vars])

save_states(filename[, variables])

Save the model states.

train_vars([method, level, include_self])

The shortcut for retrieving all trainable variables.

unique_name([name, type_])

Get the unique name for this object.

update(grads)

vars([method, level, include_self])

Collect all variables in this node and the children nodes.

Attributes

name