-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add init_params
keyword argument
#26
Conversation
Codecov Report
@@ Coverage Diff @@
## main #26 +/- ##
=======================================
Coverage 94.91% 94.91%
=======================================
Files 3 3
Lines 59 59
=======================================
Hits 56 56
Misses 3 3
Continue to review full report at Codecov.
|
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Is it reasonable to forward all keyword arguments? And do you have any application or downstream code that exploits it? Then it would be easier to see if we should use a different design or if it works sufficiently well. Would be good to add such examples to the tests as well. |
I literally want to do: function inital_sample(rng, m::MyModel; init_params, kwargs...)
return init_params
end But I wanted to take an approach that would not affect the current package, hence the general |
BTW regarding initial parameters the plan is to move the |
So ideally we would just support the AbstractMCMC interface for initial parameters but of course this would require the upstream changes first. |
Is there any open PR yet? |
Yeah, unfortunately not. I'll add it to my (growing) list of things that should be prioritized... Until then, I suggest following the convention in other Turing packages such as AdvancedMH (https://github.com/TuringLang/AdvancedMH.jl/blob/361a66905947799d7945818862673d07d5568b16/src/mh-core.jl#L78-L81) or DynamicPPL and supporting an explicit |
I can see the point. But is there a general performance impact on passing all |
Additionally, do you want me to modify the current function initial_sample(rng, model::ESSModel; init_params=nothing)
return init_params == nothing ? rand(rng, prior(model)) ? init_params
end |
I don't think so. But it seems easier to not have to overload any methods but just handle it in the implementation of f = init_params === nothing ? ... : init_params
... |
No, I think it is simpler to just handle |
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.
This would be my suggestion.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Looks good so far!
Can you also mention it in the documentation (since it's not one of the standard AbstractMCMC keyword arguments (yet) that we refer to in the docs) and update the version number?
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
init_params
keyword argument
Great, thanks @theogf! |
The idea behing this PR is to allow different behavior for
initial_sample
by passing thekwargs
as well. Typically passing a defined starting point for the MCMC chain.