Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
IMO the current optimization we provide is quite lacking. In particular, it seems (I couldn't get it to work with constrained models) as if we support the Optimizations.jl interface through SciMLBase, but it's not really exposed nor documented. Moreover, it's exposed through this
optim_problem
(which is also exported btw) that returns several things that might not be obvious to the user.I suggest the following:
src/optimization
module.maximum_a_posteriori(model, solver; kwargs...)
andmaximum_likelihood(model, solver; kwargs...)
, where thesolver
is whatever Optimizations.jl accepts (and similarly the kwargs).adtype
have some default type. Currently, if you try to use something likeOptim.Newton
, it will error with some obscure message which really just comes down to the fact thatadtype=SciMLBase.NoAD()
(which is contrary to everything else we do in Turing.jl, which is all "ad is enabled by default", no?)Related: #2164
@mhauru