-
Notifications
You must be signed in to change notification settings - Fork 17
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 state_from_transition
, parameters
and setparameters!!
#86
Open
torfjelde
wants to merge
18
commits into
master
Choose a base branch
from
tor/state-transition-related
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e2bdfb7
added state_from_transition, parameters and setparameters!!
torfjelde 7fa8de0
Update src/AbstractMCMC.jl
torfjelde 0a4fd17
renamed state_from_transition to updatestate!!
torfjelde 28bdf91
adhere to julia convention
torfjelde 86a7826
added docs
torfjelde e19cea7
fixed docs
torfjelde d86499f
fixed docs
torfjelde bce436d
added example for why updatestate!! is useful
torfjelde 21f4d56
improved MixtureState example
torfjelde de0e5b2
further improvements to docs
torfjelde 23b9119
renamed parameters and setparameters!! to values and setvalues!!
torfjelde b9f476c
fixed typo in docs
torfjelde f7b6096
fixed documenting values
torfjelde 4ca57b0
improved and fixed some bugs in docs
torfjelde abebd59
fixed typo in docs
torfjelde d1d4642
renamed values and setvalues!! to realize and realize!!
torfjelde c6c9554
added model to updatestate!!
torfjelde d9f8585
Merge branch 'master' into tor/state-transition-related
torfjelde File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -79,6 +79,34 @@ | |||
""" | ||||
struct MCMCSerial <: AbstractMCMCEnsemble end | ||||
|
||||
""" | ||||
updatestate!!(state, transition_prev[, state_prev]) | ||||
|
||||
Return new instance of `state` using information from `transition_prev` and, optionally, `state_prev`. | ||||
|
||||
Defaults to `setvalues!!(state, values(transition_prev))`. | ||||
""" | ||||
updatestate!!(state, transition_prev, state_prev) = updatestate!!(state, transition_prev) | ||||
updatestate!!(state, transition) = setvalues!!(state, Base.values(transition)) | ||||
|
||||
""" | ||||
setvalues!!(state, values) | ||||
|
||||
Update the values of the `state` with `values` and return it. | ||||
|
||||
If `state` can be updated in-place, it is expected that this function returns `state` with updated | ||||
values. Otherwise a new `state` object with the new `values` is returned. | ||||
""" | ||||
function setvalues!! end | ||||
|
||||
@doc """ | ||||
values(transition) | ||||
|
||||
Return values in `transition`. | ||||
""" | ||||
Base.values | ||||
|
||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||
include("samplingstats.jl") | ||||
include("logging.jl") | ||||
include("interface.jl") | ||||
|
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.
Do we really want to use
Base.values
here? I think adding this documentation should be considered type piracy and would only be allowed if we define it only for our own types as arguments (which we can't do here).Unrelated, why did you use
@doc
?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.
Hmm, I do agree with this. I'm coming around to
values
not being the best idea.IIRC you need
@doc
here to be able to add the docstring? I.e. if you remove the@doc
it won't be added to the docstring ofBase.values
.