-
Notifications
You must be signed in to change notification settings - Fork 43
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 getparams
and setparams!!
following AbstractMCMC v5.5 and v5.6
#378
Merged
Merged
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
eedb02f
add `getparams` and `setparams!!`
sunxd3 f340df7
undo formatting
sunxd3 161efff
Update test/abstractmcmc.jl
sunxd3 933efe5
add some new tests
sunxd3 4b0be7f
update `setparams!!`
sunxd3 8f801d4
Update src/abstractmcmc.jl
sunxd3 57f9e2b
add comment
sunxd3 26b0970
Update abstractmcmc.jl
sunxd3 b9dfa36
format
sunxd3 c7f3163
update implementation
sunxd3 9d05e46
bump AbstractMCMC
sunxd3 3b05769
update test
sunxd3 480dedc
Update src/abstractmcmc.jl
sunxd3 faf5bb0
fix method ambiguity
sunxd3 cd35f1b
Update src/abstractmcmc.jl
sunxd3 3711a0c
Update src/abstractmcmc.jl
sunxd3 027cd31
fix test error
sunxd3 30dca23
fix more test error
sunxd3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
One dangerous aspect there is that
state.transition
caches the logjoint and gradient computations. So when you use the@set
macro here, you're going to also keep the cached log-joint and gradient computation, which will then be out of sync with the parameters.If you then naively pass this transition somewhere, say, into the next
step
call, AHMC.jl will use the incorrect logjoint eval in the MH step.IMO the safe way is to use the explicit constructor of
PhasePoint
I believe without passing in the cached values. This should result in receomputation of this.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.
just realized that
model
is not passed intosetparams!!
, I think for now, we only set the parameters, then when use the transition, logp should be recomputed. (we can also later introduce some likesetlogp
orcompute_logp
etc.) I'll add a comment in the codeThere 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.
Agreed with @torfjelde's concern. Can we add
logdensitymodel
tosetparams!!(state, logdensitymodel, params)
getparam(state, logdensitymodel)
.where
logdensitymodel
follows theLogDensityProblem
interface. This would allow us to recompute the model's log probability (i.e.,recompute_logp
) inside thesesetparam!!
functions on demand, which Turing's new Gibbs sampler uses.