Debian Codegraph @

tests/prob_prog/demos/5/Model.hs

raw
1 module Model where
2
3 import Probability
4
5 -- sequence of @n points [from, next,....,to] where the distribution
6 -- of the point after x is (f x).
7
8 bridge 2 f from to = do
9 observe to (f from)
10 return [from,to]
11
12 bridge n f from to = do
13 next <- prior $ f from
14 xs <- bridge (n-1) f next to
15 return (from:xs)
16
17
18 -- 20 element brownian bridge from 0 to 4
19 model = do
20 xs <- bridge 20 (\x -> normal x 1) 0 4
21
22 return ["xs" %=% xs]
23
24 main logDir = do
25 return model