Skip to content

Convenience macros to use within @model #714

Open
@torfjelde

Description

@torfjelde

This is an issue which have been discussed multiple times before, but generally as part of other issues / PRs rather than as its own issue.

The question is mainly: should we provide some convenience macros for users that can be used within @model to achieve different behaviors?

More specifically, I have the following macros in mind (with names ofc being up for discussion) to start with:

  1. @isobservation(x): returns true if the variable x is considered an observation according to the model. Ref: Supporting mutating ADs in models that fill arrays of parameters #412
  2. @observed_value(x): returns the observed value for x (assuming it's indeed observed). Ref: Supporting mutating ADs in models that fill arrays of parameters #412

Others that we might also want to consider, but these I think require more thought:

  1. @is_post_inference: indicates whether we're performing "post-inference" analysis rather than performing inference (or something else). Ref: Should we have a context to indicate that we're not performing inference? #510 .

I bring this up now because the argument against this has always been "we don't want to have too many macros", but in #696 , we're introducing @prefix (in addition to @returned_quantities, but this is meant to replace @submodel) and seem to be embracing macros quite a bit more? Hence it seems like a useful moment to re-raise the issue.

Related issues: #412 , #510.

Metadata

Metadata

Assignees

No one assigned

    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