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

ENH: optimize._hessian: use _jacobian to compute accurate Hessian #20708

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mdhaber
Copy link
Contributor

@mdhaber mdhaber commented May 13, 2024

Reference issue

Follow-up to gh-20630

What does this implement/fix?

Adds a private function to compute accurate Hessians using a finite difference approximation. Vectorized to compute Hessian at an arbitrary number of points in a single call.

Additional information

This is a pretty rough draft. We need to:

  • Test (and fix, where applicable) attributes of return object (for this and _jacobian). It doesn't look like nfev is correct.
  • Improve error estimate by considering error of _jacobian. (@steppi)
  • Consider adding features to help user vectorize with respect to multiple parameters. (Probably a separate PR.)
  • Consider using first Jacobian evaluation to estimate appropriate step size. This could reduce number of iterations required in subsequent evaluations. (Probably a separate PR.)

@mdhaber mdhaber added enhancement A new feature or improvement scipy.optimize labels May 13, 2024
Comment on lines +732 to +733
- ``-4`` : Iteration was terminated by `callback`.
- ``1`` : The algorithm is proceeding normally (in `callback` only).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using callback right now.

Suggested change
- ``-4`` : Iteration was terminated by `callback`.
- ``1`` : The algorithm is proceeding normally (in `callback` only).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or improvement scipy.optimize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant