import Data.Ratio
main = do
print $ dicePosteriors
[6] [6] [[6], [6,4,8,7,7,2,6], [4,8,7,7,2,6], [6,8,7,7,5,4]]
dicePosteriors xxs suite = f xxs
where
f (x:xs) = g (p x [1,1..]) xs
where
g ys [] = ys
g ys (h:t) = g (p h ys) t
p x priors
= map (/ n
) zs
where
ls
= map (likelihood x
) suite
likelihood x hypo
| hypo < x = 0
aW1wb3J0IERhdGEuUmF0aW8KCm1haW4gOjogSU8gKCkKbWFpbiA9IGRvCiAgcHJpbnQgJCBkaWNlUG9zdGVyaW9ycyBbNl0gWzZdCiAgbWFwTV8gKHByaW50IC4gbWFwIGZyb21SYXRpb25hbCAuIGZsaXAgZGljZVBvc3RlcmlvcnMgWzQsNiw4LDEyLDIwXSkKICAgICAgICBbWzZdLCBbNiw0LDgsNyw3LDIsNl0sIFs0LDgsNyw3LDIsNl0sIFs2LDgsNyw3LDUsNF1dCgpkaWNlUG9zdGVyaW9ycyA6OiBbSW50ZWdlcl0gLT4gW0ludGVnZXJdIC0+IFtSYXRpbyBJbnRlZ2VyXQpkaWNlUG9zdGVyaW9ycyB4eHMgc3VpdGUgPSBmIHh4cwogIHdoZXJlCiAgICBmICh4OnhzKSA9IGcgKHAgeCBbMSwxLi5dKSB4cwogICAgICB3aGVyZQogICAgICAgIGcgeXMgW10gICAgID0geXMKICAgICAgICBnIHlzIChoOnQpID0gZyAocCBoIHlzKSB0CiAgICBwIHggcHJpb3JzID0gbWFwICgvIG4pIHpzCiAgICAgIHdoZXJlCiAgICAgICAgbiAgPSBzdW0genMKICAgICAgICB6cyA9IHppcFdpdGggKCopIHByaW9ycyBscwogICAgICAgIGxzID0gbWFwIChsaWtlbGlob29kIHgpIHN1aXRlCgogICAgbGlrZWxpaG9vZCA6OiBJbnRlZ2VyIC0+IEludGVnZXIgLT4gUmF0aW8gSW50ZWdlcgogICAgbGlrZWxpaG9vZCB4IGh5cG8KICAgICAgfCBoeXBvIDwgeCAgPSAwCiAgICAgIHwgb3RoZXJ3aXNlID0gMSAlIGh5cG8K
[1 % 1]
[0.0,0.39215686274509803,0.29411764705882354,0.19607843137254902,0.11764705882352941]
[0.0,0.0,0.9432484536722126,5.52061280612909e-2,1.5454182664965531e-3]
[0.0,0.0,0.91584527196901,8.040342579700499e-2,3.7513022339850646e-3]
[0.0,0.0,0.91584527196901,8.040342579700499e-2,3.7513022339850646e-3]