-
Notifications
You must be signed in to change notification settings - Fork 33
Drop .~
syntax entirely
#825
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
Comments
I would find it semantically confusing to say that a vector is distributed according to a univariate distribution. This also goes strongly against the convention of Julia where you have to use broadcasted I appreciate that our |
I'm not opposed to the syntax change, but I'm unsure about how to implement this because at macro time we can't determine whether we need to use filldist or not @model function f()
y ~ Normal()
x = Array{Float64}(undef, 2, 3)
x ~ Normal()
end Here we don't want to use
I haven't thought about it super deeply yet though |
If we had |
We could consider contributing a new y ~ Normal() # standard univariate RV
x ~ iid_distribution(Normal(), 2, 3) # similar to `.~` This would allow us to replace |
Not particularly relevant to the full discussion, but to add to your commeont here @mhauru: it's also worth noting that some things that would make sense if we followed broadcasting semantics in Julia fully doesn't quite make sense in a An example is x = Matrix(undef, 2, 1)
x .~ reshape(fill(Normal(), 2), 1, 2) This would technically work in Turing, but results in sampling both of the components of |
The
.~
syntax allows one to define parameters in a vectorised manner:#804 introduced extra constraints on the RHS: it has to be univariate distributions. This makes the need for the broadcasting syntax
.
questionable: it is much less flexible than Julia's broadcasting. So, using the broadcasting.~
might be confusing actually. I think we should further simplify vectorised tilde intoThis is semantically equivalent to
x ~ filldist(UnivariateDistribution(), 4)
but with a cleaner syntax. It also provides a clean syntax for supporting (univariate) identically-independently-distributed (IID) distributions discussed previously.This proposal is also consistent with the Stan syntax for vectorised random variables.
The text was updated successfully, but these errors were encountered: