-
Notifications
You must be signed in to change notification settings - Fork 225
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
Change broadcasting for ~ macro #476
Comments
I think |
@trappmartin I agree with your point regarding Julia-ness, but we're quite closely tied in to the To provide a concrete example of where we would get in trouble using a |
Thanks, @willtebbutt! The convention of the Let's keep this issue open and see if we can find a more transparent solution to this. I feel that the implicit broadcasting solution we currently have is sub-optimal. |
Agreed regarding the convention. FWIW, I had the same problem in Stheno.jl with regards to data sets. The inputs to a GP (or any other model for that matter) might be a vector of scalars, a matrix of for which each row or column should be interpreted as an observation, etc. My solution is to require that all data sets subtype struct ColsAreObs{T, TX<:AbstractMatrix{T}} <: AbstractVector{Vector{T}}
X::TX
ColsAreObs(X::TX) where {T, TX<:AbstractMatrix{T}} = new{T, TX}(X)
end designed exactly to handle the situation described above, with the interpretation is that the nth column of With this design you lose some conventions that people are used to seeing, but you gain consistency in terms of the interface for all of the data types without sacrificing any performance (provided that you specialise correctly) |
Related discussion from |
Another reason to stick to Distributions' convention is that the vectorised version of
Ideally we'd like to call these vectorised version of Although this is not very consistent in Distributions are this vectorized version for univariate version is deprecated. If you try this for |
Is the |
I'm not sure what the
edit: we should find out what the |
So here are some thoughts I have on this issue. I like the Let's take the
The above is possible to achieve only with dispatch on the Now for the
Implementing the above would again require only careful dispatching. That said, doing it for all the inference algorithms may be annoying since we have quite a few. So I still need to figure out a nicer way to implement and maintain this easily. FWIW, once we have the So far we also don't have a multi-threading (shared memory parallelism) array type like Comments? |
I had some prototypes back in v0.6, then they got massacred from the v1.0 broadcast changes so I'd have to start from scratch and never picked it up again. So yes, please implement them in KissThreading.jl and I'll be forever grateful. |
Cool, I will try to get some basic implementation done, at least to forward the I also forgot to mention above that a similar approach will need to be taken for |
Closed via #965. |
Currently the
~
macro automatically uses broadcasting if the left-hand side is a vector and the right-hand side a univariate distribution. It would be more convenient for testing and for the user to change it to an explicit syntax, i.e..~
, which would also better match the standard Julia syntax.@yebai What happens in the case of multivariate distributions?
The text was updated successfully, but these errors were encountered: