-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Someone asked me if it would be possible to nest an existing Stan model within a model defined in another PPL using bridgestan. Currently the major limitation of doing this is that we have no way to autodiff through the constraining transformation. We also would in general need to be able to separately compute the following:
- the log-density wrt constrained parameters
- the gradient of the above
- the constraining transform
- the unconstraining transform
- the pushforward/pullback (AKA jvp and vjp) of the constraining transform
- the logdetjac correction wrt unconstrained parameters
- the gradient of the above
As far as I can tell, only the two transforms are currently part of the API. The available log-density and gradient are only wrt unconstrained parameters, the Jacobian adjustment is only available as part of the density calculation, and no AD primitives are available for the transforms.
This is purely exploratory at this stage, but I wonder if it would be feasible and of interest to include the missing functionality in the API.