Mostly we preferred (as do the domain experts we target) to write
probabilistic models in direct style rather than monadic
grassModel :: PM Bool
grassModel =
let_ (flip_ 0.3) (\ rain ->
let_ (flip_ 0.5) (\ sprinkler ->
let_ (dis (con (flip_ 0.9) rain)
(dis (con (flip_ 0.8) sprinkler)
(flip_ 0.1))) (\ grassIsWet ->
if_ grassIsWet rain (dist []))))
and
grassModel = do
rain <- flip_ 0.3
sprinkler <- flip_ 0.5
wetInRain <- flip_ 0.9
wetInSprinkler <- flip_ 0.8
wetInOther <- flip_ 0.1
let grassIsWet = rain && wetInRain
|| sprinkler && wetInSprinkler
|| wetInOther
if grassIsWet then return rain else dist []
By domain expert preferring direct style do you mean that they prefer the first version over the 2nd version?thanks,Daryoush
Hello! Thank you for your interest.
Daryoush Mehrtash <dmehrtash@gmail.com> wrote in haskell-cafe:
> Is the "Embedded domain-specific language HANSEI for probabilistic modelsThe closest to that I know of is this one:
> and (nested) inference" described in:
> http://okmij.org/ftp/kakuritu/index.html#implementation available in
> Haskell?
http://d.hatena.ne.jp/rst76/20100706
https://github.com/rst76/probability
Or you can apply this monad transformer to a probability monad:
http://sebfisch.github.com/explicit-sharing/
Mostly we preferred (as do the domain experts we target) to write
> Is there a reason why the author did the package in Ocaml
> rather than Haskell?
probabilistic models in direct style rather than monadic style.
Haskell's laziness doesn't help -- in fact, to avoid running out of
memory, we'd have to defeat that memoization by sprinkling "() ->"
throughout the types.
--
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
1st graffitiist: QUESTION AUTHORITY!
2nd graffitiist: Why?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe