Skip to content

Functionality necessary to nest Stan models in other PPLs #169

@sethaxen

Description

@sethaxen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions