SUSE Package Hub 15 one-click install Install ghc-hasty-hamiltonian NOTE: This one-click installation requires that the SUSE Package Hub extension to already be enabled. See http://packagehub.suse.com/how-to-use/ for information on enabling the Package Hub extension If the extension is not enabled, this installation will fail while trying to enable an invalid repo. This package might depend on packages from SUSE Linux Enterprise modules. If those modules are not enabled, a package dependency error will be encountered. SUSE-PackageHub-15-Standard-Pool Package Hub 15 Dummy repo - this will fail ghc-hasty-hamiltonian Speedy traversal through parameter space 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 <https://hackage.haskell.org/package/ad ad> library for automatic differentiation. Exports a 'mcmc' function that prints a trace to stdout, a 'chain' function for collecting results in memory, and 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. SUSE Package Hub 15 one-click install Install ghc-hasty-hamiltonian NOTE: This one-click installation requires that the SUSE Package Hub extension to already be enabled. See http://packagehub.suse.com/how-to-use/ for information on enabling the Package Hub extension If the extension is not enabled, this installation will fail while trying to enable an invalid repo. This package might depend on packages from SUSE Linux Enterprise modules. If those modules are not enabled, a package dependency error will be encountered. SUSE-PackageHub-15-Standard-Pool Package Hub 15 Dummy repo - this will fail ghc-hasty-hamiltonian Speedy traversal through parameter space 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 <https://hackage.haskell.org/package/ad ad> library for automatic differentiation. Exports a 'mcmc' function that prints a trace to stdout, a 'chain' function for collecting results in memory, and 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.