hasty-hamiltonian: Speedy traversal through parameter space.

[ library, mit, numeric ] [ Propose Tags ]

Gradient-based traversal through parameter space.

This implementation of HMC 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.

If you don't want to calculate your gradients by hand you can use the handy ad library for automatic differentiation.

Exports a mcmc function that prints a trace to stdout, as well as a hamiltonian transition operator that can be used more generally.

import Numeric.AD (grad)
import Numeric.MCMC.Hamiltonian

target :: RealFloat a => [a] -> a
target [x0, x1] = negate ((x0 + 2 * x1 - 7) ^ 2 + (2 * x0 + x1 - 5) ^ 2)

gTarget :: [Double] -> [Double]
gTarget = grad target

booth :: Target [Double]
booth = Target target (Just gTarget)

main :: IO ()
main = withSystemRandom . asGenIO $ mcmc 10000 0.05 20 [0, 0] booth

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.2.0, 1.3.0, 1.3.2, 1.3.3, 1.3.4
Dependencies base (<5), lens, mcmc-types (>=1.0.1), mwc-probability (>=1.0.1), pipes, primitive, transformers [details]
License MIT
Author Jared Tobin
Maintainer jared@jtobin.ca
Category Numeric
Home page http://jtobin.github.com/hasty-hamiltonian
Source repo head: git clone http://github.com/jtobin/hasty-hamiltonian.git
Uploaded by JaredTobin at 2015-10-08T08:34:02Z
Distributions LTSHaskell:1.3.4, NixOS:1.3.4, Stackage:1.3.4
Reverse Dependencies 1 direct, 1 indirect [details]
Downloads 6626 total (30 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2015-10-08 [all 1 reports]