commited636761efb39d18a6c01d9d36587d808eda6dc6parent46840992f48ad098199b914da1a67838b1bf1a25Author:Jared Tobin <jared@jtobin.ca>Date:Sun, 3 Apr 2016 20:13:42 +0700 Update readme and cabal description.Diffstat:

M | README.md | | | 35 | +++++++++++++++++++++++++++++++++-- |

M | flat-mcmc.cabal | | | 33 | +++++++++++++++++++++++++++++++-- |

M | test/Rosenbrock.hs | | | 15 | +++++++-------- |

3 files changed, 71 insertions(+), 12 deletions(-)diff --git a/README.md b/README.md@@ -1,4 +1,35 @@ -# flat-mcmc [![Build Status](https://secure.travis-ci.org/jtobin/flat-mcmc.png)](http://travis-ci.org/jtobin/flat-mcmc) +# flat-mcmc [![Build Status](https://secure.travis-ci.org/jtobin/flat-mcmc.png)](http://travis-ci.org/jtobin/flat-mcmc) -Painless general-purpose sampling. +*flat-mcmc* is a Haskell library for painless, efficient, general-purpose +sampling from continuous distributions. +*flat-mcmc* uses an ensemble sampler that is invariant to affine +transformations of space. It wanders a target probability distribution's +parameter space as if it had been "flattened" or "unstretched" in some sense, +allowing many particles to explore it locally and in parallel. + +In general this sampler is useful when you want decent performance without +dealing with any tuning parameters or local proposal distributions. + +*flat-mcmc* exports an 'mcmc' function that prints a trace to stdout, as well +as a 'flat' transition operator that can be used more generally. + +``` haskell +import Numeric.MCMC.Flat +import Data.Vector (Vector, toList, fromList) + +rosenbrock :: Vector Double -> Double +rosenbrock xs = negate (5 *(x1 - x0 ^ 2) ^ 2 + 0.05 * (1 - x0) ^ 2) where + [x0, x1] = toList xs + +ensemble :: Ensemble +ensemble = fromList [ + fromList [negate 1.0, negate 1.0] + , fromList [negate 1.0, 1.0] + , fromList [1.0, negate 1.0] + , fromList [1.0, 1.0] + ] + +main :: IO () +main = withSystemRandom . asGenIO $ mcmc 25000 ensemble rosenbrock +```diff --git a/flat-mcmc.cabal b/flat-mcmc.cabal@@ -10,8 +10,37 @@ category: Math build-type: Simple cabal-version: >=1.10 description: - - Painless general-purpose sampling. + *flat-mcmc* is a Haskell library for painless, efficient, general-purpose + sampling from continuous distributions. + . + *flat-mcmc* uses an ensemble sampler that is invariant to affine + transformations of space. It wanders a target probability distribution's + parameter space as if it had been "flattened" or "unstretched" in some sense, + allowing many particles to explore it locally and in parallel. + . + In general this sampler is useful when you want decent performance without + dealing with any tuning parameters or local proposal distributions. + . + *flat-mcmc* exports an 'mcmc' function that prints a trace to stdout, as well + as a 'flat' transition operator that can be used more generally. + . + > import Numeric.MCMC.Flat + > import Data.Vector (Vector, toList, fromList) + > + > rosenbrock :: Vector Double -> Double + > rosenbrock xs = negate (5 *(x1 - x0 ^ 2) ^ 2 + 0.05 * (1 - x0) ^ 2) where + > [x0, x1] = toList xs + > + > ensemble :: Ensemble + > ensemble = fromList [ + > fromList [negate 1.0, negate 1.0] + > , fromList [negate 1.0, 1.0] + > , fromList [1.0, negate 1.0] + > , fromList [1.0, 1.0] + > ] + > + > main :: IO () + > main = withSystemRandom . asGenIO $ mcmc 25000 ensemble rosenbrock Source-repository head Type: gitdiff --git a/test/Rosenbrock.hs b/test/Rosenbrock.hs@@ -3,19 +3,18 @@ module Main where import Numeric.MCMC.Flat -import Data.Vector (Vector) -import qualified Data.Vector as V (toList, fromList) +import Data.Vector (Vector, toList, fromList) rosenbrock :: Vector Double -> Double rosenbrock xs = negate (5 *(x1 - x0 ^ 2) ^ 2 + 0.05 * (1 - x0) ^ 2) where - [x0, x1] = V.toList xs + [x0, x1] = toList xs ensemble :: Ensemble -ensemble = V.fromList [ - V.fromList [negate 1.0, negate 1.0] - , V.fromList [negate 1.0, 1.0] - , V.fromList [1.0, negate 1.0] - , V.fromList [1.0, 1.0] +ensemble = fromList [ + fromList [negate 1.0, negate 1.0] + , fromList [negate 1.0, 1.0] + , fromList [1.0, negate 1.0] + , fromList [1.0, 1.0] ] main :: IO ()