Skip to content

Remove state-saving by default #1105

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

Merged
merged 3 commits into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/src/using-turing/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,9 @@ The following are examples of valid queries of the `Turing` model or chain:

- `prob"s = 1.0, m = 1.0, x = 1.0, y = 1.0 | model = gdemo"` calculates the joint probability of all the variables.

- After the MCMC sampling, given a `chain`, `prob"x = 1.0, y = 1.0 | chain = chain"` calculates the element-wise likelihood of `x = 1.0` and `y = 1.0` for each sample in `chain`.
- After the MCMC sampling, given a `chain`, `prob"x = 1.0, y = 1.0 | chain = chain, model = gdemo"` calculates the element-wise likelihood of `x = 1.0` and `y = 1.0` for each sample in `chain`.

- If `save_state=true` was used during sampling (i.e., `sample(model, sampler, N; save_state=true)`), you can simply do ``prob"x = 1.0, y = 1.0 | chain = chain"`.

In all the above cases, `logprob` can be used instead of `prob` to calculate the log probabilities instead.

Expand Down
4 changes: 2 additions & 2 deletions src/inference/Inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ function AbstractMCMC.bundle_samples(
ts::Vector{<:AbstractTransition},
chain_type::Type{Chains};
discard_adapt::Bool=true,
save_state=true,
save_state=false,
kwargs...
)
# Check if we have adaptation samples.
Expand Down Expand Up @@ -384,7 +384,7 @@ function AbstractMCMC.bundle_samples(
ts::Vector{<:AbstractTransition},
chain_type::Type{Vector{NamedTuple}};
discard_adapt::Bool=true,
save_state=true,
save_state=false,
kwargs...
)
nts = Vector{NamedTuple}(undef, N)
Expand Down