BayesianLogic / blog

The BLOG programming language
http://bayesianlogic.github.io/
BSD 4-Clause "Original" or "Old" License
98 stars 31 forks source link

Bug in rejection sampler? #334

Open dwadden opened 9 years ago

dwadden commented 9 years ago

Hi, I'm not a contributor, but I'm a member of MIT's Venture team. I'm trying to do some comparisons of BLOG and Venture on open-universe problems. I'm using the latest version of BLOG downloaded from the GitHub website. When I download the pre-build version, unzip the directory and enter, I get the following error:


(dw)$ bin/blog example/poisson-ball.blog -s blog.sample.RejectionSampler
Using fixed random seed for repeatability.
............................................
Constructing inference engine of class blog.engine.SamplingEngine
Constructing sampler of class blog.sample.RejectionSampler
Evidence: [ObsColor(Draw[0]) = Blue, ObsColor(Draw[1]) = Green, ObsColor(Draw[2]) = Blue, ObsColor(Draw[3]) = Green, ObsColor(Draw[4]) = Blue, ObsColor(Draw[5]) = Green, ObsColor(Draw[6]) = Blue, ObsColor(Draw[7]) = Green, ObsColor(Draw[8]) = Blue, ObsColor(Draw[9]) = Green]
Query: [/*DerivedVar*/ size({b for Ball b : true})]
Running for 10000 samples...
Query Reporting interval is 10000
Exception in thread "main" java.lang.NullPointerException
    at blog.sample.RejectionSampler.nextSample(RejectionSampler.java:183)
    at blog.engine.SamplingEngine.answerQueries(SamplingEngine.java:168)
    at blog.Main.run(Main.java:190)
    at blog.Main.main(Main.java:153)
(dw)$ 

The default likelihood-weighting sampler runs with no problem, and the rejection sampler seemed to work ok with a couple other examples I tried. Is there any reason rejection sampling doesn't work well with the poisson ball example in particular?

lileicc commented 9 years ago

Are you using the master HEAD or release 0.9.1?

dwadden commented 9 years ago

Tried it on both. Same bug. In case this is relevant - on a macbook pro running yosemite.