-
Notifications
You must be signed in to change notification settings - Fork 3
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
profile fails when OptmizationProblem algorithm uses Hessian #96
Comments
Ah. The issue is in |
As I understood the code, for each parameter that is profiled you remake the Given this, I think the one approach would be to allow if isnothing(prob.grad) # If autodiff nothing by default
grad = nothing
else
grad = (grad, θ, p) -> begin
_grad_full = get_tmp(cache_grad, grad)
_θ = get_tmp(cache, θ)
_θ[iest] .= θ
prob.f.grad(_grad_full, _θ)
grad .= _grad_full[iest]
end
end Would something like this work? |
Yeah, that looks like it would work. The same could be done for the Hessian. (I'm not sure that accessing the gradient like that in Optimization.jl is in the API, but it should be fine since I already have to use its internals [hence why its version is fixed in the Project.toml]). There are other fields for an OptimizationProblem to take care of https://docs.sciml.ai/Optimization/stable/API/optimization_function/, e.g. |
I think accessing the gradient like above should work (even though I might be slightly off with the exact syntax). Maybe at the moment letting |
Yeah, throwing errors for those other fields would be a good idea. Those are rarely used from what I can tell, and probably even rarer for profiling, so I don't see it being a problem. |
Closed with #97 |
I have tried to make PEtab.jl work together with ProfileLikelihood for user provided gradients (see #95 ).
It works well if I use an algorithm that only uses gradient (like BFGS from NLopt) (I can later make a PR to create
LikelihoodProblem
fromOptimizationProblem
):However, with
alg = Ipopt.Optimizer()
(where the Hessian is computed) the code fails with a very long error-message. The following MVE reproduces the error (I get the same error onIPNewton
from Optim.jl):With error message:
The text was updated successfully, but these errors were encountered: