-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convenience macros to use within @model
#714
Comments
Can we do a slightly different but possibly more robust workflow for advanced users:
( we need to have a convention that This way, we avoid the difficult step of automatically determining the evaluation mode, as raised in #510 (comment). |
Any thoughts on the if !@isdefined variable_that_might_be_conditioned
variable_that_might_be_conditioned = Matrix{Float64}(undef, n, m)
end which is, in some ways, the right idea, but it ofc won't work 😕 Adding something like
So the workflow you outline here is already in place right? The only difference is
Aye, this is definitively a complication! However, I think there are a few methods that might be okay to say "yes, I'm in post inference mode", e.g. predict
generated_quantities
pointwise_loglikelihoods where it would be possible to have these contexts just define a method that returns is_post_inference(::AbstractContext) = false
is_post_inference(::GeneratedQuantitiesCtx) = true
is_post_inference(::PredictCtx) = true
is_post_inference(::PointwiseLikelihoodContext) = true So this would then be a opt-in sort of thing, which we whould we quite selective with. |
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:
@isobservation(x)
: returnstrue
if the variablex
is considered an observation according to the model. Ref: Supporting mutating ADs in models that fill arrays of parameters #412@observed_value(x)
: returns the observed value forx
(assuming it's indeed observed). Ref: Supporting mutating ADs in models that fill arrays of parameters #412Others that we might also want to consider, but these I think require more thought:
@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.
The text was updated successfully, but these errors were encountered: