RxInfer.jl icon indicating copy to clipboard operation
RxInfer.jl copied to clipboard

Initializing message towards node with SVMP with multiple clusters breaks inference procedure

Open wouterwln opened this issue 6 months ago • 0 comments

This only works when we have 4 or more interfaces, since we need SVMP with 3 or more clusters. For example, in the GCV node, we have $q(x, y)q(w)q(k)q(z)$ as factorization constraint. Let's define the following model:

@model function demo(ay)
    x ~ NormalMeanVariance(0.0, 1.0)
    z ~ NormalMeanVariance(0.0, 1.0)
    k ~ NormalMeanVariance(0.0, 1.0)
    w ~ NormalMeanVariance(0.0, 1.0)
    y ~ GCV(x, z, k, w) 
    ay ~ NormalMeanVariance(y, 1.0)
end
c = @constraints begin
    q(x,y,z,k,w) = q(x, y)q(k)q(z)q(w)
end

Now in order to run inference in this model, we need to initialize the marginals on k, z and w, otherwise we cannot compute the messages towards x and y. This checks out:

i = @initialization begin
    q(k) = NormalMeanVariance(0.0, 1.0)
    q(w) = NormalMeanVariance(0.0, 1.0)
    q(z) = NormalMeanVariance(0.0, 1.0)
end

However, if we now initialize a message on y, the inference procedure breaks:

i = @initialization begin
    q(k) = NormalMeanVariance(0.0, 1.0)
    q(w) = NormalMeanVariance(0.0, 1.0)
    q(z) = NormalMeanVariance(0.0, 1.0)
    μ(y) = NormalMeanVariance(0.0, 1.0)
end
Variables [ w, k, z, x ] have not been updated after an update event. 
Therefore, make sure to initialize all required marginals and messages. See `initialization` keyword argument for the inference function. 
See the official documentation for detailed information regarding the initialization.

wouterwln avatar Aug 14 '24 14:08 wouterwln