probcomp / Venturecxx

Primary implementation of the Venture probabilistic programming system
http://probcomp.csail.mit.edu/venture/
GNU General Public License v3.0
28 stars 6 forks source link

Confusing mental model, especially with namespaces #34

Open gregory-marton opened 9 years ago

gregory-marton commented 9 years ago

Anthony: @axch, different namespaces are definitely a point of confusion. As well as "sample" vs "infer", and why "sample" returns the same value every time. Also the nonsense with run and do, of course, which muddles the core concepts somewhat. Although I think it's sort of expected in that it's an issue of constructing the right mental model. Oh right, also resample vs likelihood_weight, and why it seems like the first resample does something different from the second resample.

gregory-marton commented 9 years ago

Anthony I think there is some confusion in that "infer resample" sounds like it is doing some inference (and making 5 identical particles does not seem like inference, but resampling the values of the variables does), and "infer likelihood_weight" sounds like it is merely updating weights, rather than also resampling the variables. 15:09 axch Hah! That's an idea. I could make likelihood_weight actually do exactly that, and add reset_to_prior before it. In fact, it would be harmless if you told the students to think of it that way. Anthony I thought the weights were accumulated during the reset_to_prior though. I guess one interpretation is that it sounds like reset_to_prior should rerun the assumes, and likelihood_weight should rerun the observes. axch They are, as it happens, but do(reset_to_prior, likelihood_weight) is the same as likelihood_weight (just a bit slower). Anthony Sure. You mean, the current likelihood_weight? So it would reset to prior twice (but that's harmless). axch Yes, that's what I mean. Anthony Or I guess, reset_to_prior should also include evaluating the observed expressions, but not constraining them. axch The current reset_to_prior also sets the weights to the likelihood, but that need not be emphasized if it's confusing. (Actually, reset_to_prior and likelihood_weight are aliases, except that one is a nullary procedure computing the other). 15:17 Anthony Right. (I meant "Or I guess..." to be a continuation of "I guess one interpretation...") BenZ it doesn't seem that surprising, if you already think the idea of uncollapsed is weird I'm still in the perspective where uncollapsed SPs basically do inference even when you don't run "infer" instructions Anthony You mean collapsed. BenZ so from that view, forget undoes inference

axch commented 9 years ago

Anthony also reported that people were confused by repeated sample x returning the same thing (when x was a variable lookup).

axch commented 9 years ago

Anthony also reports that saying "the difference between 'define' and 'assume' is that assume 'flags things as uncertain'" exacerbates the mental model confusion: e.g. can you 'assume' deterministic constants?

fsaad commented 9 years ago

Another problematic word in the tutorial was

infer resample(5)

No inference is actually taking place in this statement which can be confusing (I said infer!) I propose avoid using such constructs, and prefer the clearer:

run(resample(5))
infer posterior
axch commented 9 years ago

I would say that resample(5) actually does inference, if there is more than one particle at that point.

Why would I say that? Because the distribution over results from running a program and sampling an expression at the end changes if you append resample(5) to the end of the program, except in the special case when all the program's particles at that point were guaranteed to have equal weights (for example, if there was only one of them).

That said, both run and infer are redundant at the top level in the system as it currently stands (because of #77).