boltzmann-samplers: Uniform random generators

[ data, generic, library, mit, random ] [ Propose Tags ] [ Report a vulnerability ]

Random generators with a uniform distribution conditioned to a given size. See also testing-feat, which is currently a faster method with similar results.


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
test

Enable testing. Disabled by default because the current test suite is slow and can fail with non-zero probability.

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.1.0
Change log CHANGELOG.md
Dependencies ad, base (>=4.8 && <5), containers, hashable, hmatrix, ieee754, MonadRandom, mtl, QuickCheck, semigroups, transformers, unordered-containers, vector [details]
Tested with ghc ==7.10.3, ghc ==8.0.2, ghc ==8.2.2, ghc ==8.4.1
License MIT
Author Li-yao Xia
Maintainer lysxia@gmail.com
Category Data, Generic, Random
Home page https://github.com/Lysxia/boltzmann-samplers#readme
Source repo head: git clone https://github.com/Lysxia/boltzmann-samplers
Uploaded by lyxia at 2018-04-01T16:31:08Z
Distributions LTSHaskell:0.1.1.0, NixOS:0.1.1.0, Stackage:0.1.1.0
Reverse Dependencies 3 direct, 10 indirect [details]
Downloads 2449 total (17 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-04-14 [all 1 reports]

Readme for boltzmann-samplers-0.1.1.0

[back to package description]

Boltzmann samplers Hackage Build Status

Boltzmann.Data

Define sized random generators for Data.Data generic types.

    {-# LANGUAGE DeriveDataTypeable #-}

    import Data.Data
    import Test.QuickCheck
    import Boltzmann.Data

    data Term = Lambda Int Term | App Term Term | Var Int
      deriving (Show, Data)

    instance Arbitrary Term where
      arbitrary = sized $ generatorPWith [positiveInts]

    positiveInts :: Alias Gen
    positiveInts =
      alias $ \() -> fmap getPositive arbitrary :: Gen Int

    main = sample (arbitrary :: Gen Term)
  • Objects of the same size (number of constructors) occur with the same probability (see Duchon et al., references below).
  • Implements rejection sampling and pointing.
  • Works with QuickCheck and MonadRandom, but also similar user-defined monads for randomness (just implement MonadRandomLike).
  • Can be tweaked somewhat with user defined generators.

Boltzmann.Species

An experimental interface to obtain Boltzmann samplers from an applicative specification of a combinatorial system.

No documentation (yet).

References