Skip to content
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
10 changes: 5 additions & 5 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ AbstractMCMC.MCMCSerial

Common keyword arguments for regular and parallel sampling are:
- `progress` (default: `AbstractMCMC.PROGRESS[]` which is `true` initially): toggles progress logging. See the section on [Progress logging](#progress-logging) below for more details.
- `chain_type` (default: `Any`): determines the type of the returned chain
- `chain_type` (default: `Any`): determines the type of the returned chain.
- `callback` (default: `nothing`): if `callback !== nothing`, then
`callback(rng, model, sampler, sample, iteration; kwargs...)` is called after every sampling step,
where `sample` is the most recent sample of the Markov chain and `iteration` is the current iteration
where `sample` is the most recent sample of the Markov chain and `iteration` is the current iteration.
- Keyword arguments `kwargs...` are passed down from the call to `sample(...)`. If you are performing multiple-chain sampling, then `kwargs` _additionally_ contains a `chain_number` keyword argument, which runs from 1 to the number of chains. This is not present when performing single-chain sampling.
- `num_warmup` (default: `0`): number of "warm-up" steps to take before the first "regular" step,
i.e. number of times to call [`AbstractMCMC.step_warmup`](@ref) before the first call to
- `num_warmup` (default: `0`): number of "warm-up" steps to take before the first "regular" step,
i.e. number of times to call [`AbstractMCMC.step_warmup`](@ref) before the first call to
[`AbstractMCMC.step`](@ref).
- `discard_initial` (default: `num_warmup`): number of initial samples that are discarded. Note that
if `discard_initial < num_warmup`, warm-up samples will also be included in the resulting samples.
Expand Down Expand Up @@ -151,7 +151,7 @@ AbstractMCMC.to_samples
AbstractMCMC.from_samples
```

For chains of this type, AbstractMCMC defines the following two methods.
For chains of this type, AbstractMCMC defines the following methods.

```@docs
AbstractMCMC.chainscat
Expand Down
6 changes: 3 additions & 3 deletions docs/src/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,21 @@ In each step, the sample is saved in the container by `AbstractMCMC.save!!`. The
follows the convention of the package [BangBang.jl](https://github.com/JuliaFolds/BangBang.jl)
which is used in the default implementation of `AbstractMCMC.save!!`. It indicates that the
sample is pushed to the container but a "widening" fallback is used if the container type
does not allow to save the sample. Therefore `AbstractMCMC.save!!` *always has* to return the container.
does not allow saving the sample. Therefore `AbstractMCMC.save!!` *always has* to return the container.

```@docs
AbstractMCMC.save!!
```

For most use cases the default implementation of `AbstractMCMC.samples` and `AbstractMCMC.save!!`
should work out of the box and hence need not to be overloaded in downstream code.
should work out of the box and hence need not be overloaded in downstream code.

## Creating chains

!!! note
This section does not apply to the iterator and transducer interface.

At the end of the sampling procedure for regular and paralle sampling we transform
At the end of the sampling procedure for regular and parallel sampling we transform
the collection of samples to the desired output type by calling `AbstractMCMC.bundle_samples`.

```@docs
Expand Down
4 changes: 2 additions & 2 deletions src/AbstractMCMC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ function getstats end
"""
setparams!!([model::AbstractModel, ]state, params)

Set the values of parameters in the sampler's `state` from a `Vector{<:Real}`.
Set the values of parameters in the sampler's `state` from a `Vector{<:Real}`.

This function should follow the `BangBang` interface: mutate `state` in-place if possible and
This function should follow the `BangBang` interface: mutate `state` in-place if possible and
return the mutated `state`. Otherwise, it should return a new `state` containing the updated parameters.

Although not enforced, it should hold that `setparams!!(state, getparams(state)) == state`. In other
Expand Down
2 changes: 1 addition & 1 deletion src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Save the `sample` of the MCMC `sampler` at the current `iteration` in the contai

The function can be called with and without a predefined number `N` of samples. By default,
AbstractMCMC uses `push!!` from the Julia package
[BangBang](https://github.com/tkf/BangBang.jl) to append to the container, and widen its
[BangBang](https://github.com/JuliaFolds/BangBang.jl) to append to the container, and widen its
type if needed.
"""
function save!!(
Expand Down
4 changes: 2 additions & 2 deletions src/logdensityproblems.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
LogDensityModel <: AbstractMCMC.AbstractModel

Wrapper around something that implements the LogDensityProblem.jl interface.
Wrapper around something that implements the LogDensityProblems.jl interface.

Note that this does _not_ implement the LogDensityProblems.jl interface itself,
but it simply useful for indicating to the `sample` and other `AbstractMCMC` methods
but it is simply useful for indicating to the `sample` and other `AbstractMCMC` methods
that the wrapped object implements the LogDensityProblems.jl interface.

# Fields
Expand Down
2 changes: 1 addition & 1 deletion src/sample.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ end

"""
sample(
rng::Random.AbatractRNG=Random.default_rng(),
rng::Random.AbstractRNG=Random.default_rng(),
model::AbstractModel,
sampler::AbstractSampler,
N_or_isdone;
Expand Down
Loading