From 28aa3552c66a2e6d76cd9ed0d8ef91a61f87d474 Mon Sep 17 00:00:00 2001 From: Hong Ge Date: Wed, 14 Jan 2026 11:05:47 +0000 Subject: [PATCH] fix doc typos and inaccuracies --- docs/src/api.md | 10 +++++----- docs/src/design.md | 6 +++--- src/AbstractMCMC.jl | 4 ++-- src/interface.jl | 2 +- src/logdensityproblems.jl | 4 ++-- src/sample.jl | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/src/api.md b/docs/src/api.md index c24ddfa2..5acfc696 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -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. @@ -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 diff --git a/docs/src/design.md b/docs/src/design.md index f5becb45..8d7cabb0 100644 --- a/docs/src/design.md +++ b/docs/src/design.md @@ -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 diff --git a/src/AbstractMCMC.jl b/src/AbstractMCMC.jl index bceb04fd..bf379bfb 100644 --- a/src/AbstractMCMC.jl +++ b/src/AbstractMCMC.jl @@ -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 diff --git a/src/interface.jl b/src/interface.jl index 902424d2..60b31c59 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -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!!( diff --git a/src/logdensityproblems.jl b/src/logdensityproblems.jl index f15f656a..d83d9379 100644 --- a/src/logdensityproblems.jl +++ b/src/logdensityproblems.jl @@ -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 diff --git a/src/sample.jl b/src/sample.jl index ec772c0a..afc68bcd 100644 --- a/src/sample.jl +++ b/src/sample.jl @@ -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;