-
-
Notifications
You must be signed in to change notification settings - Fork 65
Implement a minimizer for INLA #513
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
base: main
Are you sure you want to change the base?
Implement a minimizer for INLA #513
Conversation
Currently there's a few outstanding TODOs. These are just issues getting quality-of-life features to work with pytensor - the actual algorithm itself works fine. Please find the TODOs listed as comments in the code, and use the code in |
use_jac: bool = True, | ||
use_hess: bool = False, # TODO Tbh we can probably just remove this arg and pass True to the minimizer all the time, but if this is the case, it will throw a warning when the hessian doesn't need to be computed for a particular optimisation routine. | ||
optimizer_kwargs: dict | None = None, | ||
) -> list[TensorLike]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signature is wrong, this function returns numpy arrays.
But why are you compiling a pytensor function and evaluating it? This seems to just be doing find_map
? I imagine you wanted a symbolic mode
not the numerical (evaluated) one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I felt that for the purposes of INLA, we only ever needed numerical values of mode
and hess
, but in truth, simply returning the compiled function probably makes this more versatile as well as eliminating a need for x0
and args
(although these will likely need to be obtained somewhere later). I'll refactor it to return the compiled function.
Addresses #342.
This PR should add:
find_mode
Contingent on pymc-devs/pytensor#1182, as it uses
pytensor.tensor.optimize.minimize
to find the mode (and hessian at that point).