What does the unfold operator do?
The unfold operator takes a generative function and returns a new generative function implementing an application of a kernel in sequence, passing the return value of one application as an input to the next, while keeping track of scores/weights. See the Gen.dev docs of unfold.
This involves ensuring that the following functions work correctly on generative functions that have been through an unfold (correctly adding up scores/weights):
- simulate
- generate
- propose
- assess
- update
There is a reference implementation in Julia here.
Why do we want this?
We want this to help with non-parametric models based on Chinese Restaurant Processes. We target two use cases:
- Teach DPMM and CrossCat models. Gen may make it hard to implement efficient inference in these models. But that's not the goal. Instead, it will allow us to teach human-readable versions of the models (i.e. probabilistic programs). This has worked in the past -- showing Venture model code for a CrossCat model has helped certain users understand the model class.
- Sample CrossCat model structure and parameters based on simple constraints for benchmarking GenSQL queries. To estimate scaling constants we need to control model structure when assessing query execution speed with CrossCat models.
What does the unfold operator do?
The unfold operator takes a generative function and returns a new generative function implementing an application of a kernel in sequence, passing the return value of one application as an input to the next, while keeping track of scores/weights. See the Gen.dev docs of unfold.
This involves ensuring that the following functions work correctly on generative functions that have been through an unfold (correctly adding up scores/weights):
There is a reference implementation in Julia here.
Why do we want this?
We want this to help with non-parametric models based on Chinese Restaurant Processes. We target two use cases: