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

Inference using a DataArray #23

Closed
Dhuige opened this issue Jan 20, 2023 · 8 comments · Fixed by #252
Closed

Inference using a DataArray #23

Dhuige opened this issue Jan 20, 2023 · 8 comments · Fixed by #252
Assignees
Labels
next version Features considered for the next version of the library

Comments

@Dhuige
Copy link

Dhuige commented Jan 20, 2023

It might be nice to infer data using an array. Slicing the array into a vector in the model able to read it out

By which I mean that one would be able to use an array given the following:

image

@albertpod
Copy link
Member

Hi @Dhuige,

Thanks for trying out RxInfer.jl. Can you be more specific about the nature of the issue?
The model you've provided is incomplete and has unused variables, e.g. y and tau

In order to create a multivariate input, you should use the following datavar specification.

Data_Array = datavar(Vector{Float64}, N)

You can't use dot with a vector of datavars of type Float64. It must be instead a single datavar of type Vector{Float64}, e.g.

Data_Array_Univariate = datavar(Float64, N)
Data_Array_Multivariate = datavar(Vector{Float64}, N)
for i in 1:N
    Data_Array_Univariate[i] ~ dot(Data_Array_Multivariate[i], theta) + epsilon
end

We will be happy to help further if you provide more details on what you are trying to achieve with this model.

@Dhuige
Copy link
Author

Dhuige commented Jan 20, 2023

Thank you for the improvement on my code used, what I am trying to say is that it would be nice if one could use 1 Array as input and output. In this example, this would imply that a slice of the multivariate is treated as Data_Array_Univariate.

in other words:
Data_Array_Univariate = datavar(Float64, N)
Data_Array_Multivariate = datavar(Vector{Float64}, N)
for i in 1:N
Data_Array_Multivariate[:,1][i] ~ dot(Data_Array_Multivariate[i], theta) + epsilon
end

Preferably, the dot product would also work if the Data_Array_Multivariate is sliced in an array (since it will make mathematical sense, thus convenient to use).

@albertpod
Copy link
Member

I see @Dhuige. Thanks for raising the issue.
This type of model definition isn't supported yet.

@bvdmitri bvdmitri transferred this issue from ReactiveBayes/RxInfer.jl Jan 23, 2023
@bvdmitri
Copy link
Member

@albertpod @wouterwln @Dhuige We may consider this improvement in the next iteration of the GraphPPL.jl, should be doable imo

@bvdmitri bvdmitri reopened this Jan 23, 2023
@bvdmitri bvdmitri added the next version Features considered for the next version of the library label Jan 23, 2023
@albertpod albertpod moved this to 🤔 Ideas in RxInfer Feb 21, 2023
@albertpod albertpod moved this from 🤔 Ideas to 👉 Assigned in RxInfer Feb 21, 2023
@bvdmitri
Copy link
Member

bvdmitri commented Oct 5, 2023

ping @wouterwln

@albertpod albertpod moved this to 👉 Assigned in RxInfer Jan 11, 2024
@wouterwln
Copy link
Member

I think this is possible in RxInfer 3.0 onward, right?

@bvdmitri
Copy link
Member

I'm not entirely sure, better to add a test for it

@wouterwln wouterwln linked a pull request Sep 30, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from 👉 Assigned to ✅ Done in RxInfer Sep 30, 2024
@wouterwln
Copy link
Member

I added a test for this. The slicing might not work because of #246 , but I think that might also be an illegal syntax. What do you think @albertpod ? I think it does not make sense to pass a vector of individual random variables into the dot function rather than having a single multivariate random variable going in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next version Features considered for the next version of the library
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants