anglican icon indicating copy to clipboard operation
anglican copied to clipboard

observe vs observe* and sample vs sample*

Open phsamuel opened this issue 5 years ago • 0 comments

I am quite confused with the difference between the * and non-star version. In the documentation, it mentioned that observe*/sample* is anglican version and observe/sample is the clojure version. So I thought former two are always preferred. But when I tried to go through this HW exercise from the UBC course, observe* just doesn't work. More precisely, when I tried to create a query of a twice observed Gaussian model,

(defquery gaussian-model [y1 y2] (let [mu (sample (normal 1 (sqrt 5))) ; prior mean distributed with mean 1 and variance 5 mygauss (normal mu (sqrt 2))] (observe mygauss y1) ; observe work but observe* doesnt (observe mygauss y2) mu))

the above works but when observe replaced by observe*, it doesn't result in the correct estimate.

phsamuel avatar May 30 '19 05:05 phsamuel