Skip to content

pointwise_logdensities, returned, logjoint, etc. APIs are weird #1332

@penelopeysm

Description

@penelopeysm

Fundamentally all of these functions take some input, run the model, collect some accumulator's output (or the return value), and then give that back to the user.

Traditionally these have all taken a VarInfo argument. That's because they all used to call evaluate!!(model, varinfo). This makes little sense nowadays. It should take an AbstractInitStrategy argument, with some common overloads for parameter types that wrap them in InitFromParams before calling the main function. For example, logjoint(model, ...) already follows this pattern, along with returned; so the point would be to unify all of these things into a single internal method, and have logjoint, ... etc defined in terms of that method.

I think there's a reasonable amount of code duplication that could be reduced in this too. Because at the end of the day really all you're saying is: this is my model, these are my params, I want these accumulators, I want to evaluate the model and return this thing.

We could even keep the VarInfo methods; they just need to dispatch to InitFromParams(vi.values).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions