hasty-hamiltonian.cabal (2388B)
1 name: hasty-hamiltonian 2 version: 1.3.4 3 synopsis: Speedy traversal through parameter space. 4 homepage: http://github.com/jtobin/hasty-hamiltonian 5 license: MIT 6 license-file: LICENSE 7 author: Jared Tobin 8 maintainer: jared@jtobin.ca 9 category: Numeric 10 build-type: Simple 11 tested-with: GHC == 8.2.2, GHC == 8.8.3 12 cabal-version: >= 1.10 13 Description: 14 Gradient-based traversal through parameter space. 15 . 16 This implementation of HMC algorithm uses 'lens' as a means to operate over 17 generic indexed traversable functors, so you can expect it to work if your 18 target function takes a list, vector, map, sequence, etc. as its argument. 19 . 20 If you don't want to calculate your gradients by hand you can use the 21 handy <https://hackage.haskell.org/package/ad ad> library for automatic 22 differentiation. 23 . 24 Exports a 'mcmc' function that prints a trace to stdout, a 'chain' function 25 for collecting results in memory, and a 'hamiltonian' transition operator 26 that can be used more generally. 27 . 28 > import Numeric.AD (grad) 29 > import Numeric.MCMC.Hamiltonian 30 > 31 > target :: RealFloat a => [a] -> a 32 > target [x0, x1] = negate ((x0 + 2 * x1 - 7) ^ 2 + (2 * x0 + x1 - 5) ^ 2) 33 > 34 > gTarget :: [Double] -> [Double] 35 > gTarget = grad target 36 > 37 > booth :: Target [Double] 38 > booth = Target target (Just gTarget) 39 > 40 > main :: IO () 41 > main = withSystemRandom . asGenIO $ mcmc 10000 0.05 20 [0, 0] booth 42 43 Source-repository head 44 Type: git 45 Location: http://github.com/jtobin/hasty-hamiltonian.git 46 47 library 48 default-language: Haskell2010 49 ghc-options: 50 -Wall 51 exposed-modules: 52 Numeric.MCMC.Hamiltonian 53 build-depends: 54 base >= 4 && < 6 55 , kan-extensions >= 5 && < 6 56 , mcmc-types >= 1.0.1 57 , mwc-probability >= 2.0 && < 3 58 , lens >= 4 && < 6 59 , pipes >= 4 && < 5 60 , primitive >= 0.5 && < 1.0 61 , transformers >= 0.5 && < 1.0 62 63 Test-suite booth 64 type: exitcode-stdio-1.0 65 hs-source-dirs: test 66 main-is: Booth.hs 67 default-language: Haskell2010 68 ghc-options: 69 -rtsopts 70 build-depends: 71 ad >= 4 && < 5 72 , base >= 4 && < 6 73 , mwc-probability >= 2.0 && < 3 74 , hasty-hamiltonian 75