pybop.optimisers._gradient_descent#

Classes#

GradientDescentImpl

Gradient descent method with a fixed, per-dimension learning rate.

Module Contents#

class pybop.optimisers._gradient_descent.GradientDescentImpl(x0, sigma0=0.02, boundaries=None)[source]#

Bases: pints.Optimiser

Gradient descent method with a fixed, per-dimension learning rate.

Gradient descent updates the current position in the direction of the steepest descent, as determined by the negative of the gradient of the function.

The update rule for each iteration is given by:

\[x_{t+1} = x_t - \eta * \nabla f(x_t)\]
where:
  • \(x_t\) are the current parameter values at iteration t,

  • \(\nabla f(x_t)\) is the gradient of the function at \(x_t\),

  • \(\eta\) is the learning rate, which controls the step size.

This class reimplements the Pints’ Gradient Descent, but with multidimensional, fixed learning rates. Original creation and credit is attributed to Pints.

Parameters:
  • x0 (array-like) – Initial starting point for the optimisation. This should be a 1D array representing the starting parameter values for the function being optimised.

  • sigma0 (float or array-like, optional) – Initial learning rate or rates for each dimension. If a scalar is provided, the same learning rate is applied across all dimensions. If an array is provided, each dimension will have its own learning rate. Defaults to 0.02.

  • boundaries (pybop.Boundaries, optional) – Boundaries for the parameters. This optimiser ignores boundaries and operates as an unbounded method. Defaults to None.

_x_best#

The best parameter values (solution) found so far.

Type:

array-like

_f_best[source]#

The best function value (objective value) found so far.

Type:

float

_current#

The current parameter values at the latest iteration.

Type:

array-like

_eta[source]#

The current learning rate(s). Can be a scalar or per-dimension array.

Type:

array-like

_running[source]#

Indicates whether the optimisation process is running.

Type:

bool

_ready_for_tell[source]#

Indicates whether the optimiser is ready to receive feedback from the objective function.

Type:

bool

ask()[source]#

Proposes the next point for evaluation.

f_best()[source]#

Returns the best objective value found.

learning_rate()[source]#

Returns the learning rate(s).

n_hyper_parameters()[source]#

Returns the number of hyper-parameters (learning rate).

name()[source]#

Returns the name of the optimiser.

needs_sensitivities()[source]#

Indicates this optimiser requires gradient information.

running()[source]#

Returns whether the optimiser is running.

set_hyper_parameters(x)[source]#

Sets hyper-parameters (learning rate).

set_learning_rate(eta)[source]#

Sets the learning rate. Supports per-dimension rates.

Parameters:

eta (float or array-like) – New learning rate(s).

tell(reply)[source]#

Updates optimiser with function evaluation results.

x_best()[source]#

Returns the best solution found.

_eta[source]#
_f_best[source]#
_ready_for_tell = False[source]#
_running = False[source]#