probcomp / Venturecxx

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

Block enumeration on dependent principal nodes may generate wrong stationary distribution #462

Open axch opened 8 years ago

axch commented 8 years ago

Block enumeration proceeds thus:

This is problematic if the set of options available at node B can depend on the value chosen for node A. Example situations where that might happen:

The fact that enumerateValues is called pre-detach is also problematic. Consider three CRP applications being jointly enumerated. Up to renumbering the tables (but not reordering the applications), there are five possible partitions: (1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2), (1, 2, 3). However, the size of the set of combinations that the above enumeration algorithm will consider will be some perfect cube. In fact, the cube in question will actually depend on the initial state -- 2^3 from (1, 1, 1), 3^3 from any of the middle configurations, or 4^3 from (1, 2, 3). This means that enumeration will consider some equivalent combinations more than once; and, since none of the cubes are 5^3, will necessarily consider some combinations different numbers of times from others. I conjecture that it will overweight the configurations it overcounts.

axch commented 8 years ago

From conversation with @luac, the following looks like a solution. It essentially amounts to making LKernels that use amb, but with what amounts to an ad-hoc delimited continuation structure instead of trying to mess with the actual Python interpreter's actual continuations.

To wit, define a new kind of LKernel, called, say, SearchNodeLKernel, and attach a bunch of them, sharing a common (mutable) search tree state. After a proposal, the state of the tree indicates the values that have been proposed, and, at each node, the remaining agenda for the consequences of all the previous nodes being given the values currently in the tree. Before a proposal, the state indicates the values to propose. The special value None means "when you get here, query the operator's enumerateValues method, store that as the agenda, and propose the first element." Stepping from completed proposal to next proposal can be done in the enumeration loop.

Issues:

axch commented 8 years ago

Another use case: Block enumerating a discrete choice together with an exactly guarding one of its consequences. If asked first, the exactly will report one possible output, namely the one it currently has -- defeating the purpose of including it in the block.

My revision to @pgmoren 's HDP-HMM model has this problem.