【发布时间】:2021-08-07 04:15:12
【问题描述】:
ProbLog 和/或 prolog/cplint 是否支持使用分布和具体化分布、条件/观察等,例如 WebPPL 中的以下示例。
如果是,你是怎么做到的?
/我知道 cplint 支持的可能是发行版,但是具体化?/
// sampling function, condition() acts
// like filter i.e. the match is excluded from sampling result
var test = function() {
var a = flip() //Bernoulli
var b = flip()
condition(a||b)
return {a:a,b:b}
}
//reifying a distribution
var abc = Infer({method: 'rejection', samples:1000}, test)
abc
$ webppl test2.wppl
Marginal:
{"a":false,"b":true} : 0.337
{"a":true,"b":false} : 0.332
{"a":true,"b":true} : 0.331
【问题讨论】:
标签: prolog probability problog webppl