ReactiveBayes / RxInfer.jl

Julia package for automated Bayesian inference on a factor graph with reactive message passing
MIT License
242 stars 24 forks source link

initmarginals accept an array argument with different length #175

Closed bvdmitri closed 7 months ago

bvdmitri commented 8 months ago

setmarginals! from ReactiveMP uses zip, hence this

initmarginals = (z= [NormalMeanVariance(0, 1)],)

Will initialize only the first z and skip the rest. We should use broadcasting instead

bvdmitri commented 8 months ago

@Nimrais This task has been added to the milestone for tracking and prioritization.

Nimrais commented 8 months ago

I understand the issue at hand.

But how do we want to resolve it?

initmarginals = (z= container,)

it should assign the each marginal associated with the symbol z to container itself. On the other hand, if we use:

initmarginals = (z.=container,)

then it should assign each index of z to the value at the aligned index in container, am I right?

bvdmitri commented 8 months ago

each marginal associated with the symbol z to container itself

No, it should simply check that the lengths of z and the container match before calling zip. See here. Please do the same for messages here

initmarginals = (z.=container,)

This syntax is not possible in Julia, we don't support it at all, so no need to do anything here