Open albertpod opened 6 months ago
@albertpod This task has been added to the milestone for tracking and prioritization.
Just dropping my thoughts on this issue.
When you specify {allow_missing = true}
, RxInfer.jl starts treating the datavar
as a random variable. Given the constraints, this effectively means that q_y_x
contains the joint distribution between the point mass and a Gaussian. RxInfer.jl will attempt to trigger @rule NormalMeanPrecision(:τ, Marginalisation) (q_out_μ::Any,)
, which includes mean_cov(q_out_μ)
, and finally the function mean(f, itr)
from Statistics.jl, where the division of this form occurs /(::PointMass{Float64}, ::Int64)
.
We can create a method for computing statistics of such joints. Alternatively, we can provide special treatment for datavars
that contain both data and missing values and perform additional separation of the variables inside the infer
function.
I see. To properly fix this issue we probably should reimplement the way @rule
macro works (which is by itself is a long standing issue). I can come up with a hot fix, but I don't think this would be ideal or work in all situations.
Following our discussion with @leostenzel and @bartvanerp, I've come across the following issue that occurs with nonmissing (observed) data points when the structured constraint is specified.
This results in
which makes sense given that we can't compute the
mean_cov(q_out_μ)
.To circumvent the error, we should use a different constraint:
which is a correct constraint but will result in underestimated variance in the prediction message (only
γ
will contribute).EDIT: I wouldn't say it's necessarily a bug but it's something we need to think of.