Skip to content

Models, VarInfos, what you can do with them, evaluation, initialisation. #660

@penelopeysm

Description

@penelopeysm

There's surprisingly little (or no?) documentation about what you can do with a model. For example, you can execute a model with (::Model)(), get samples with rand(::Model), ...

Also, conceptually, I don't think there's any documentation that says conceptually what a VarInfo is. You just kind of pick it up by realising that it gets carried around everywhere.

I think that this sort of stuff is super important for anybody trying to write a DynamicPPLExt but right now there's no way to get into it apart from reading DynamicPPL source code.

Broad outline:

  • Things you can do to a model: return values, rand, (... not sure if there's anything else here)
  • Fundamentally, all of the above use DynamicPPL.evaluate!! under the hood, this is the 'central function of DynamicPPL'.
  • An intro to VarInfo, its role as 'model trace' / or I prefer to think of it as execution state
  • How do you populate a new VarInfo: with DynamicPPL.init!!
  • unflatten and LogDensityFunction

This page would probably stay away from the internal structure of VarInfo and things like typed/untyped. Firstly, those topics may change in the medium term. Secondly, those are probably of less interest anyway since those are fairly internal to DynamicPPL. I suspect many developers don't need to go beyond the points above.

For a follow-up, see #664.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions