probmods / webppl

Probabilistic programming for the web
http://webppl.org
Other
619 stars 86 forks source link

Bug in viz (or dist...) for multiple dimensions #865

Closed insperatum closed 7 years ago

insperatum commented 7 years ago

I was experimenting with the following model and came across some surprising behaviour. Running on webppl.org as of today:

var dist = Uniform({a:0, b:1})
var guide = Beta({a:2, b:1})

var model1 = function() {
  var y = sample(guide)
  factor(dist.score(y) - guide.score(y))
  return y
}

var model2 = function() {
  var y = sample(guide)
  factor(dist.score(y) - guide.score(y))
  return {x:"foo", y:y}
}

viz(Infer({method:"MCMC", samples:100000}, model1))
viz(Infer({method:"MCMC", samples:100000}, model2))

The distribution for model1 looks like dist (as it should) while the distribution for model2 looks like guide.

null-a commented 7 years ago

This looks like a problem with webppl-viz, I've opened probmods/webppl-viz#84 with a potential fix.

Thanks for reporting this!