openfl.utilities.optimizers.numpy.adagrad_optimizer.NumPyAdagrad

class openfl.utilities.optimizers.numpy.adagrad_optimizer.NumPyAdagrad(*, params: Dict[str, ndarray] | None = None, model_interface=None, learning_rate: float = 0.01, initial_accumulator_value: float = 0.1, epsilon: float = 1e-10)

Bases: Optimizer

Adagrad optimizer implementation.

Implements the Adagrad optimization algorithm using NumPy. Adagrad is an algorithm for gradient-based optimization that adapts the learning rate to the parameters, performing smaller updates for parameters associated with frequently occurring features, and larger updates for parameters associated with infrequent features.

Original paper: http://jmlr.org/papers/v12/duchi11a.html

Class Attributes:
  • params (dict, optional) – Parameters to be stored for optimization.

  • model_interface – Model interface instance to provide parameters.

  • learning_rate (float) – Tuning parameter that determines the step size at each iteration.

  • initial_accumulator_value (float) – Initial value for squared gradients.

  • epsilon (float) – Value for computational stability.

Methods

step

Perform a single step for parameter update.

step(gradients: Dict[str, ndarray]) None

Perform a single step for parameter update.

Implement Adagrad optimizer weights update rule.

Parameters:

gradients (dict) – Partial derivatives with respect to optimized parameters.

Raises:

KeyError – If a key in gradients does not exist in optimized parameters.