Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Red-Portal committed Aug 12, 2024
1 parent c2ec380 commit 25c9d18
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 8 deletions.
53 changes: 46 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ For general usage, please refer to [here](https://turinglang.org/SliceSampling.j
## Implemented Algorithms
### Univariate Slice Sampling Algorithms
- Univariate slice sampling ([Slice](https://turinglang.org/SliceSampling.jl/dev/univariate_slice/)) algorithms by R. Neal [^N2003]:
- Fixed window
- stepping-out window adaptation
- doubling-out window adaptation
- Fixed window (`Slice`)
- stepping-out window adaptation (`SliceSteppingOut`)
- doubling-out window adaptation (`SliceDoublingOut`)

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

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

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

The following slice samplers can also be used as a conditional sampler in `Turing.Experimental.Gibbs` sampler:
* For multidimensional variables:
* `RandPermGibbs`
* `HitAndRun`
* For unidimensional variables:
* `Slice`
* `SliceSteppingOut`
* `SliceDoublingOut`

See the following example:
```julia
using Distributions
using Turing
using SliceSampling

@model function simple_choice(xs)
p ~ Beta(2, 2)
z ~ Bernoulli(p)
for i in 1:length(xs)
if z == 1
xs[i] ~ Normal(0, 1)
else
xs[i] ~ Normal(2, 1)
end
end
end

sampler = Turing.Experimental.Gibbs(
(
p = externalsampler(SliceSteppingOut(2.0)),
z = PG(20, :z)
)
)

n_samples = 1000
model = simple_choice([1.5, 2.0, 0.3])
sample(model, sampler, n_samples)
```

[^N2003]: Neal, R. M. (2003). Slice sampling. The annals of statistics, 31(3), 705-767.
[^LW2023]: Li, Y., & Walker, S. G. (2023). A latent slice sampling algorithm. Computational Statistics & Data Analysis, 179, 107652.
[^SHR2023]: Schär, P., Habeck, M., & Rudolf, D. (2023, July). Gibbsian polar slice sampling. In International Conference on Machine Learning.
Expand Down
1 change: 0 additions & 1 deletion docs/src/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ sample(model, externalsampler(sampler), n_samples)

```@example turinggibbs
using Distributions
using FillArrays
using Turing
using SliceSampling
Expand Down

2 comments on commit 25c9d18

@Red-Portal
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

  • Add support for Turing.Experimental.Gibbs.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/112994

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.0 -m "<description of version>" 25c9d1845f8125a2660fd52b76f1f660426817b6
git push origin v0.6.0

Please sign in to comment.