Skip to content

Commit 25c9d18

Browse files
committed
update docs
1 parent c2ec380 commit 25c9d18

File tree

2 files changed

+46
-8
lines changed

2 files changed

+46
-8
lines changed

README.md

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ For general usage, please refer to [here](https://turinglang.org/SliceSampling.j
1111
## Implemented Algorithms
1212
### Univariate Slice Sampling Algorithms
1313
- Univariate slice sampling ([Slice](https://turinglang.org/SliceSampling.jl/dev/univariate_slice/)) algorithms by R. Neal [^N2003]:
14-
- Fixed window
15-
- stepping-out window adaptation
16-
- doubling-out window adaptation
14+
- Fixed window (`Slice`)
15+
- stepping-out window adaptation (`SliceSteppingOut`)
16+
- doubling-out window adaptation (`SliceDoublingOut`)
1717

1818
### Meta Multivariate Samplers for Augmenting Univariate Samplers
19-
- Random permutation coordinate-wise Gibbs sampling[^GG1984]
20-
- Hit-and-run sampling[^BRS1993]
19+
- Random permutation coordinate-wise Gibbs sampling[^GG1984] (`RandPermGibbs`)
20+
- Hit-and-run sampling[^BRS1993] (`HitAndRun`)
2121

2222
### Multivariate Slice Sampling Algorithms
23-
- Latent slice sampling ([LSS](https://turinglang.org/SliceSampling.jl/dev/latent_slice/)) by Li and Walker[^LW2023]
24-
- Gibbsian polar slice sampling ([GPSS](https://turinglang.org/SliceSampling.jl/dev/gibbs_polar/)) by P. Schär, M. Habeck, and D. Rudolf[^SHR2023].
23+
- Latent slice sampling ([LSS](https://turinglang.org/SliceSampling.jl/dev/latent_slice/)) by Li and Walker[^LW2023] (`LatentSlice`)
24+
- Gibbsian polar slice sampling ([GPSS](https://turinglang.org/SliceSampling.jl/dev/gibbs_polar/)) by P. Schär, M. Habeck, and D. Rudolf[^SHR2023] (`GibbsPolarSlice`)
2525

2626
## Example with Turing Models
2727
This package supports the [Turing](https://github.com/TuringLang/Turing.jl) probabilistic programming framework:
@@ -42,6 +42,45 @@ model = demo()
4242
sample(model, externalsampler(sampler), n_samples)
4343
```
4444

45+
The following slice samplers can also be used as a conditional sampler in `Turing.Experimental.Gibbs` sampler:
46+
* For multidimensional variables:
47+
* `RandPermGibbs`
48+
* `HitAndRun`
49+
* For unidimensional variables:
50+
* `Slice`
51+
* `SliceSteppingOut`
52+
* `SliceDoublingOut`
53+
54+
See the following example:
55+
```julia
56+
using Distributions
57+
using Turing
58+
using SliceSampling
59+
60+
@model function simple_choice(xs)
61+
p ~ Beta(2, 2)
62+
z ~ Bernoulli(p)
63+
for i in 1:length(xs)
64+
if z == 1
65+
xs[i] ~ Normal(0, 1)
66+
else
67+
xs[i] ~ Normal(2, 1)
68+
end
69+
end
70+
end
71+
72+
sampler = Turing.Experimental.Gibbs(
73+
(
74+
p = externalsampler(SliceSteppingOut(2.0)),
75+
z = PG(20, :z)
76+
)
77+
)
78+
79+
n_samples = 1000
80+
model = simple_choice([1.5, 2.0, 0.3])
81+
sample(model, sampler, n_samples)
82+
```
83+
4584
[^N2003]: Neal, R. M. (2003). Slice sampling. The annals of statistics, 31(3), 705-767.
4685
[^LW2023]: Li, Y., & Walker, S. G. (2023). A latent slice sampling algorithm. Computational Statistics & Data Analysis, 179, 107652.
4786
[^SHR2023]: Schär, P., Habeck, M., & Rudolf, D. (2023, July). Gibbsian polar slice sampling. In International Conference on Machine Learning.

docs/src/general.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ sample(model, externalsampler(sampler), n_samples)
6565

6666
```@example turinggibbs
6767
using Distributions
68-
using FillArrays
6968
using Turing
7069
using SliceSampling
7170

0 commit comments

Comments
 (0)