Skip to content
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

Broadcast mimic for Univariate nodes #35

Open
kirill-kondrashov opened this issue Mar 14, 2019 · 0 comments
Open

Broadcast mimic for Univariate nodes #35

kirill-kondrashov opened this issue Mar 14, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@kirill-kondrashov
Copy link

In order to properly stack i.i.d. variables in a vector, I suggest to introduce a sort of broadcasting for (some of?) ::Univariate nodes.

Let’s say, I have a distribution, for example, Gamma, which is available only as ::Univariate. I can do that:

D = 2
x = Vector{Variable}(undef, D)
for d in 1:D
  @RV x[d] ~ Gamma(1, 1)
end

But further in the code x is ::Vector{Variable}, so you cannot use it in the model with some kind of vector arithmetics. I'd rather want it as follows:

@RV x ~ Gamma(ones(2), ones(2))

so that further x is a proper vector of two i.i.d. Gamma components.

The broadcast mimic option for Gamma node in this sense follows the spirit of other Julia packages (for instance, I can type pdf.(Gamma(1,1), x) where x can be either Array or scalar).

@kirill-kondrashov kirill-kondrashov added the enhancement New feature or request label Mar 14, 2019
@ThijsvdLaar ThijsvdLaar self-assigned this Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants