Conditional variable initialisation in `AmiciObjective.check_gradients_match_finite_differences`
Gradient check for an AmiciObjective
pypesto_problem.objective.check_gradients_match_finite_differences(
x=startpoints[0],
)
invokes an error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/maren/pyPESTO/pypesto/objective/amici/amici.py", line 665, in check_gradients_match_finite_differences
*args, x=x, x_free=x_free, **kwargs
^^^^^^
UnboundLocalError: cannot access local variable 'x_free' where it is not associated with a value
This is because x_free is only created if the condition in line 651 is True.
Version 0.5.1
Is there a point to inheriting the check_gradients_match_finite_differences in the scope of AmiciObjective. at all? Using the PEtab nominal parameter vector is only used for testing and that default behaviour should at least be documented.
Linked to https://github.com/ICB-DCM/pyPESTO/issues/723
Is there a point to inheriting the
check_gradients_match_finite_differencesin the scope ofAmiciObjective.at all? Using the PEtab nominal parameter vector is only used for testing and that default behaviour should at least be documented.
From my point of view, this could be removed completely. There is no clear understanding of what should be given as nominal parameter, but most often this will be the optimized parameters, which is not the best location for the finite difference checks due to vanishing gradients.
closing this for now, due to new release