probcomp / Gen.jl

A general-purpose probabilistic programming system with programmable inference

Home Page:https://gen.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document that `ParamUpdate(..., gf)` will only update parameters initialized at the time of construction

alex-lew opened this issue · comments

ParamUpdate objects track sets of parameters to update. When a ParamUpdate is constructed, the user can manually provide a list of parameters it should track, or the user can pass in a generative function, with the meaning "track all parameters owned by this generative function."

However, when the generative function is written in the dynamic DSL, Gen has no way of knowing what parameters the GF introduces unless the user explicitly initializes them. When the ParamUpdate object is created before the parameters are initialized, the parameters do not end up tracked by the ParamUpdate object.

This leads to counterintuitive order-dependent behavior, as in #414.

We should at the very least document this behavior. Even better would be to find a way to get around it, e.g. by having a different kind of ParamObject that, whenever necessary, checked the GF in question for newly initialized parameters.