Improved Rprop- (iRprop-)¶
- class pints.IRPropMin(x0, sigma0=0.1, boundaries=None)[source]¶
iRprop- algorithm, as described in Figure 3 of [1].
The name “iRprop-” was introduced by [1], and is a variation on the “Resilient backpropagation (Rprop)” optimiser introduced in [2].
This is a local optimiser that requires gradient information, although it uses only the direction (sign) of the gradient in each dimension and ignores the magnitude. Instead, it maintains a separate step size for each dimension which grows when the sign of the gradient stays the same and shrinks when it changes.
Pseudo-code is given below. Here
p_j[i]
denotes the j-th parameter at iterationi
, anddf_j[i]
is the corresponding derivative of the objective function (so both are scalars):if df_j[i] * df_j[i - 1] > 0: step_size_j[i] = 1.2 * step_size_j[i - 1] elif df_j[i] * df_j[i - 1] < 0: step_size_j[i] = 0.5 * step_size_j[i - 1] df_j[i] = 0 step_size_j[i] = min(max(step_size_j[i], min_step_size), max_step_size) p_j[i] = p_j[i] - sign(df_j[i]) * step_size_j[i]
The line
df_j[i] = 0
has two effects:It sets the update at this iteration to zero (using
sign(df_j[i]) * step_size_j[i] = 0 * step_size_j[i]
).It ensures that the next iteration is performed (since
df_j[i] * df_j[i - 1] == 0
so neither if-statement holds).
In this implementation, the initial
step_size
is set tosigma0
, the default minimum step size is set as1e-3 * min(sigma0)
, and no default maximum step size is set. Minimum and maximum step sizes can be changed withset_min_step_size()
andset_max_step_size()
or through the hyper-parameter interface.If boundaries are provided, an extra step is added at the end of the algorithm that reduces the step size where boundary constraints are not met. For
RectangularBoundaries
this works on a per-dimension basis:while p_j[i] < lower or p_j[i] >= upper: step_size_j[i] *= 0.5 p_j[i] = p_j[i] - sign(df_j[i]) * step_size_j[i]
For general boundaries a more complex heuristic is used: First, the step size in all dimensions is reduced until the boundary constraints are met. Next, this reduction is undone for each dimension in turn: if the constraint is still met without the reduction the step size in this dimension is left unchanged.
The numbers 0.5 and 1.2 shown in the (main and boundary) pseudo-code are technically hyper-parameters, but are fixed in this implementation.
References
- ask()[source]¶
See
Optimiser.ask()
.
- f_best()[source]¶
See
Optimiser.f_best()
.
- name()[source]¶
See
Optimiser.name()
.
- running()[source]¶
See
Optimiser.running()
.
- set_hyper_parameters(x)[source]¶
See
pints.TunableMethod.set_hyper_parameters()
.The hyper-parameter vector is
[min_step_size, max_step_size]
.
- set_max_step_size(step_size)[source]¶
Sets the maximum step size (use
None
to let step sizes grow indefinitely).
- set_min_step_size(step_size)[source]¶
Sets the minimum step size (use
None
to let step sizes shrink indefinitely).
- stop()¶
Checks if this method has run into trouble and should terminate. Returns
False
if everything’s fine, or a short message (e.g. “Ill-conditioned matrix.”) if the method should terminate.
- tell(reply)[source]¶
See
Optimiser.tell()
.
- x_best()[source]¶
See
Optimiser.x_best()
.