Skip to content

Commit e1220d1

Browse files
committed
fix max number of proposals for GPSS and update documentation
1 parent c2aae8c commit e1220d1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/SliceSampling.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ function exceeded_max_prop(max_prop::Int)
7272
"A quick fix is to increase `max_prop`, ",
7373
"but an acceptance rate that is too low often indicates that there is a problem. ",
7474
"Here are some possible causes:\n",
75-
"- The model might be broken or degenerate. (most likely cause)\n",
76-
"- The initialization is pathologic. (try supplying a different `initial_params`)\n",
75+
"- The model might be broken or degenerate (most likely cause).\n",
76+
"- The tunable parameters of the sampler are suboptimal.\n",
77+
"- The initialization is pathologic. (try supplying a (different) `initial_params`)\n",
7778
"- There might be a bug in the sampler. (if this is suspected, file an issue to `SliceSampling`)\n"
7879
)
7980
end

src/multivariate/gibbspolar.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ Gibbsian polar slice sampling algorithm by P. Schär, M. Habeck, and D. Rudolf [
99
1010
# Keyword Arguments
1111
- `w::Real`: Initial window size for the radius shrinkage procedure
12-
- `max_proposals::Int`: Maximum number of proposals allowed until throwing an error (default: `10^6`).
12+
- `max_proposals::Int`: Maximum number of proposals allowed until throwing an error (default: `$(DEFAULT_MAX_PROPOSALS)`).
1313
1414
!!! info
1515
By the nature of polar coordinates, GPSS only works reliably for targets with dimension at least \$\$d \\geq 2\$\$.
1616
17+
!!! info
18+
The initial window size `w` must be set at least an order of magnitude larger than what is sensible for other slice samplers. Otherwise, a large number of rejections might be experienced.
19+
1720
!!! warning
1821
When initializing the chain (*e.g.* the `initial_params` keyword arguments in `AbstractMCMC.sample`), it is necessary to inialize from a point \$\$x_0\$\$ that has a sensible norm \$\$\\lVert x_0 \\rVert > 0\$\$, otherwise, the chain will start from a pathologic point in polar coordinates. This might even result in the sampler getting stuck in an infinite loop. (This can be prevented by setting `max_proposals`.) If \$\$\\lVert x_0 \\rVert \\leq 10^{-5}\$\$, the current implementation will display a warning.
1922
@@ -25,7 +28,7 @@ struct GibbsPolarSlice{W <: Real} <: AbstractMultivariateSliceSampling
2528
max_proposals::Int
2629
end
2730

28-
GibbsPolarSlice(w::Real; max_proposals::Int = 10^6) = GibbsPolarSlice(w, max_proposals)
31+
GibbsPolarSlice(w::Real; max_proposals::Int = DEFAULT_MAX_PROPOSALS) = GibbsPolarSlice(w, max_proposals)
2932

3033
struct GibbsPolarSliceState{T <: Transition, R <: Real, D <: AbstractVector}
3134
"Current [`Transition`](@ref)."

0 commit comments

Comments
 (0)