Description
GD raises a deprecation warning if atol or rtol are passed and are !=0. But the default value if they're not passed is None so the deprecation warning is also raised if the arguments are not used at all.
|
self.rtol = kwargs.pop('rtol', None) # to be deprecated (released in 25.0) |
|
self.atol = kwargs.pop('atol', None) # to be deprecated (released in 25.0) |
|
|
|
|
|
if kwargs.get('objective_function') is not None: # to be deprecated |
|
warn('The argument `objective_function` will be deprecated in the future. Please use `f` instead.', DeprecationWarning, stacklevel=2) |
|
if f is not None: |
|
raise ValueError('The argument `objective_function` is being deprecated, replaced by `f`. Please use just `f` not both') |
|
f = kwargs.pop('objective_function') |
|
|
|
|
|
if self.alpha is not None or self.beta is not None: # to be deprecated |
|
warn('To modify the parameters for the Armijo rule please use `step_size_rule=ArmijoStepSizeRule(alpha, beta, kmax)`. The arguments `alpha` and `beta` will be deprecated. ', DeprecationWarning, stacklevel=2) |
|
|
|
if self.rtol!=0 or self.atol!=0: # to be deprecated (released in 25.0) |
|
warn('`rtol` and `atol` are deprecated. For early stopping, please use a callback (cil.optimisation.utilities.callbacks), for example `EarlyStoppingObjectiveValue`.', DeprecationWarning, stacklevel=2) |
|
else: |
|
log.warn('Breaking backwards compatibility, GD no longer automatically stops if the objective function is close to zero. For this functionality, please use a callback (cil.optimisation.utilities.callbacks).' ) |
myGD_LS = GD(initial=x0,
f=f1,
step_size=None,
update_objective_interval=10)
DeprecationWarning: `rtol` and `atol` are deprecated. For early stopping, please use a callback (cil.optimisation.utilities.callbacks), for example `EarlyStoppingObjectiveValue`.
myGD_LS = GD(initial=x0,
Environment
import cil, sys
print(cil.version.version, cil.version.commit_hash, sys.version, sys.platform)
24.3.0 None 3.12.8 | packaged by conda-forge | (main, Dec 5 2024, 14:24:40) [GCC 13.3.0] linux
Description
GD raises a deprecation warning if
atolorrtolare passed and are !=0. But the default value if they're not passed is None so the deprecation warning is also raised if the arguments are not used at all.CIL/Wrappers/Python/cil/optimisation/algorithms/GD.py
Lines 50 to 67 in a14ac33
Environment
24.3.0 None 3.12.8 | packaged by conda-forge | (main, Dec 5 2024, 14:24:40) [GCC 13.3.0] linux