pypomp.Newton¶
- class pypomp.Newton(clip_norm: float | None = None, scale: bool = False, ls: bool = False, c: float = 0.1, max_ls_itn: int = 10)[source]¶
Bases:
OptimizerClassic Second-Order Newton-Raphson optimizer.
- step(grad: Array, state: tuple, step_num: int | Array, compute_hessian_fn: Callable[[], Array] | None = None, eta_i: Array | None = None) tuple[Array, tuple][source]¶
Compute the parameter update direction and update the optimizer state.
- Parameters:
grad (jax.Array) – The gradient of the objective function with respect to the parameters.
state (tuple) – The current optimizer state buffers.
step_num (int or jax.Array) – The current iteration or step index (0-indexed).
compute_hessian_fn (callable, optional) – A zero-argument callable that computes the model Hessian when invoked. Only called if the optimizer requires the Hessian (e.g. Newton methods).
eta_i (jax.Array, optional) – The current step size/learning rate at this iteration. Only used if the optimizer requires it (e.g. BFGS).
- Returns:
direction (jax.Array) – The parameter update search direction.
new_state (tuple) – The updated optimizer state buffers.