Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sensi_orders in gradient checks #1487

Open
dilpath opened this issue Oct 13, 2024 · 1 comment
Open

Support sensi_orders in gradient checks #1487

dilpath opened this issue Oct 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@dilpath
Copy link
Member

dilpath commented Oct 13, 2024

While debugging another model, the issue arose again that sometimes Objective(x, sensi_orders=(0,)) provides a different fval than Objective(x, sensi_orders=(0,1)). Tolerances etc. can be adjusted until these two are similar; however, pyPESTO's check_grad might incorrectly report that gradients are not close, because it computes fval with sensis

fval, grad = self(x, (0 + order, 1 + order), mode)

but fval_p and fval_m (for the plus/minus steps used in finite difference approximations) without sensis

fval_p = self(x_p, (0,), mode)

fval_m = self(x_m, (0,), mode)

This could be resolved by using the same sensi_orders in all function calls, or otherwise providing some way for the user to specify this.

@dilpath dilpath added the bug Something isn't working label Oct 13, 2024
@dweindl
Copy link
Member

dweindl commented Oct 14, 2024

This could be resolved by using the same sensi_orders in all function calls, or otherwise providing some way for the user to specify this.

It might make sense to address that independently of gradient checks, since this will also be a problem for any optimizer that calls the objective with varying sensi_orders. Maybe a simple wrapper around Objective that always passes a certain sensi_orders internally and then filters the result to match the externally requested sensi_orders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants