-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feature: aliases and keyword distribution specification in the model macro #18
Conversation
Looks great! |
Thanks @bartvanerp ! I will add Initially this PR implemented |
@wmkouw This feature also enables this
But only static sum can be unrolled at a parse time, e.g. this is still not possible
|
I am happy with these aliases: I think they really add to the user-friendliness of RMP. But the feature to add multiple variables at once, i.e.,
does not solve the issue with unnecessary loops being constructed. Perhaps I just need a custom node that implements a linear combination. Something along the lines of:
which implements |
This PR adds aliases feature to model specification (
@model
macro):See ReactiveBayes/ReactiveMP.jl#1 and #17
In the first version the following aliases are available:
a || b
: alias forOR(a, b)
nodea && b
: alias forAND(a, b)
nodea -> b
: alias forIMPLY(a, b)
node¬a
or!a
: alias forNOT(a)
nodea + b + c
: alias for(a + b) + c
Normal(μ|m|mean = ..., σ²|τ⁻¹|v|var|variance = ...)
alias forNormalMeanVariance(..., ...)
nodeNormal(μ|m|mean = ..., τ|σ⁻²|w|p|prec|precision = ...)
alias forNormalMeanVariance(..., ...)
nodeMvNormal(μ|m|mean = ..., Σ|V|Λ⁻¹|cov|covariance = ...)
alias forMvNormalMeanCovariance(..., ...)
nodeMvNormal(μ|m|mean = ..., Λ|W|Σ⁻¹|prec|precision = ...)
alias forMvNormalMeanPrecision(..., ...)
nodeExample
TODO:
Update:
a * b * c
: alias for (a * b) * cGamma(α|a|shape = ..., θ|β⁻¹|scale = ...)
alias forGammaShapeScale(..., ...) node.
Gamma(α|a|shape = ..., β|θ⁻¹|rate = ...)
alias forGammaShapeRate(..., ...) node.