mighty-metropolis

The classic Metropolis algorithm.
git clone git://git.jtobin.io/mighty-metropolis.git
Log | Files | Refs | README | LICENSE

README.md (804B)


      1 # mighty-metropolis
      2 
      3 The classic Metropolis algorithm.  Wander around parameter space according to a
      4 simple spherical Gaussian distribution.
      5 
      6 Exports a `mcmc` function that prints a trace to stdout, a `chain` function for
      7 collecting results in memory, and a `metropolis` transition operator that can
      8 be used more generally.
      9 
     10 See the *test* directory for example usage.
     11 
     12     import Numeric.MCMC.Metropolis
     13 
     14     rosenbrock :: [Double] -> Double
     15     rosenbrock [x0, x1] = negate (5  *(x1 - x0 ^ 2) ^ 2 + 0.05 * (1 - x0) ^ 2)
     16 
     17     main :: IO ()
     18     main = withSystemRandom . asGenIO $ mcmc 10000 1 [0, 0] rosenbrock
     19 
     20 *mighty-metropolis* is a member of the [declarative][decl] suite of libraries,
     21 containing a bunch of MCMC algorithms that play nicely together.
     22 
     23 [decl]: https://github.com/jtobin/declarative