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

Do we want to make a version of two-argument categorical that collapses out the choice? #473

Open axch opened 8 years ago

axch commented 8 years ago

For example, here's a way to make a 2-D clustering model with a fixed number of clusters:

[assume c1_mu (mvn (array 0 0) (id_matrix 2))]
[assume c1_sig (inv_wishart ...)]
c2, c3 likewise
[assume weights (dirichlet ...)]
[assume point (make_c_categorical weights
  (list (lambda () (mvn c1_mu c1_sig))
        (lambda () (mvn c2_mu c2_sig))
        (lambda () (mvn c3_mu c3_sig))))]

Here observe (point) (vector foo bar) is expected to collapse out the cluster choice (which are independent given the cluster parameters). This is analogous to what is expected in Stan (HMC can now be applied to the weights and the cluster parameters).

The more typical (to date) way to do Gaussian clustering in Venture is to collapse out the cluster parameters and the weights, and leave the assignments uncollapsed:

[assume c1 (make_cmvn ...)]
[assume c2 (make_cmvn ...)]
[assume c3 (make_cmvn ...)]
[assume cluster (make_dir_cat ... (list c1 c2 c3))]
[assume point ((cluster))]

The inferential difference for local M-H type inference programs is that in the former, it will take O(3*#points) work to evaluate a proposal to the weights or the cluster parameters, but on the other hand, there are only O(3) variables to do inference on. In the latter, by contrast, there are O(#points) variables to infer, but evaluating a proposal to one takes only O(3) work.

Also

In any case, I think it would be nice to be able to implement the former collapsing style. This seems to require the made SP from make_c_categorical to assess by querying the assessments of its constituents, which seems nontrivial.

Can this be further collapsed by integrating out the weights too, or not?

axch commented 8 years ago

The project management decision is whether/when to do this. This also calls for design, and possibly math or planning.