DynamicPPL.jl icon indicating copy to clipboard operation
DynamicPPL.jl copied to clipboard

Storing returned values in `VarInfo`.

Open yebai opened this issue 1 year ago • 0 comments

We have debated for length about how to handle returned values from a DynamicPPL model, and use that as a way to store extra non-parameter model variables (e.g. transformed variables and generated quantities; see here). One straightforward approach is to introduce an extra field in SimpleVarInfo, e.g.

struct SimpleVarInfo
   logp
   values
   ret_values
   transformation
end

We can safely compress the ret_values and values into one field and skip ret_values during inference.

More generally, the returned value can be a closure, allowing us to easily perform post-inference tasks, e.g., prediction.

yebai avatar Sep 01 '23 17:09 yebai