speedy-slice: Speedy slice sampling.

[ library, math, mit ] [ Propose Tags ] [ Report a vulnerability ]

Speedy slice sampling.

This implementation of the slice sampling algorithm uses lens as a means to operate over generic indexed traversable functors, so you can expect it to work if your target function takes a list, vector, map, sequence, etc. as its argument.

Additionally you can sample over anything that's an instance of both Num and Variate, which is useful in the case of discrete parameters.

Exports a mcmc function that prints a trace to stdout, a chain function for collecting results in memory, and a slice transition operator that can be used more generally.

import Numeric.MCMC.Slice
import Data.Sequence (Seq, index, fromList)

bnn :: Seq Double -> Double
bnn xs = -0.5 * (x0 ^ 2 * x1 ^ 2 + x0 ^ 2 + x1 ^ 2 - 8 * x0 - 8 * x1) where
  x0 = index xs 0
  x1 = index xs 1

main :: IO ()
main = withSystemRandom . asGenIO $ mcmc 10000 1 (fromList [0, 0]) bnn

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.2.0, 0.3.0, 0.3.1, 0.3.2
Dependencies base (>=4 && <6), kan-extensions (>=5 && <6), lens (>=4 && <6), mcmc-types (>=1.0.1), mwc-probability (>=1.0.1), pipes (>=4 && <5), primitive (>=0.6 && <1.0), transformers (>=0.5 && <1.0) [details]
Tested with ghc ==8.8.3
License MIT
Author Jared Tobin
Maintainer jared@jtobin.ca
Revised Revision 1 made by JaredTobin at 2024-11-09T07:40:42Z
Category Math
Home page http://github.com/jtobin/speedy-slice
Source repo head: git clone http://github.com/jtobin/speedy-slice.git
Uploaded by JaredTobin at 2021-02-21T07:49:28Z
Distributions LTSHaskell:0.3.2, NixOS:0.3.2, Stackage:0.3.2
Reverse Dependencies 1 direct, 1 indirect [details]
Downloads 6234 total (20 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-02-21 [all 1 reports]