Skip to content

[Bug]: Mean/variance undefined for Uninformative() entries #588

@RetrospectiveRotations

Description

@RetrospectiveRotations

Description

When expanding the documentation of RxInfer.jl with uninformative entries, I noticed that the basic beta-bernouilli example returns an error because the mean/variance of pointmasses of Uninformative() entries are not defined.

Expected Behavior

The inference call should complete without error.

Actual Behavior

The inference call stopped.

Minimal Reproducible Example or steps to reproduce the issue

@model function beta_bernoulli(y, a, b)
    θ ~ Beta(a, b)  
    for i in 1:length(y)
        y[i] ~ Bernoulli(θ)
    end
end

result = infer(
    model = beta_bernoulli(a = 1.0, b = 1.0),
    data  = (y = [ true, false, Uninformative(), true, false ], )
)

Error Message / Stack Trace

exception =
│    StackOverflowError:
│    Stacktrace:
│         [1] mean(itr::PointMass{Uninformative})
│           @ Statistics C:\Users\peter\.julia\packages\Statistics\gbcbG\src\Statistics.jl:44
│         [2] mean(fn::typeof(identity), distribution::PointMass{Uninformative})
│           @ BayesBase C:\Users\peter\.julia\packages\BayesBase\THarC\src\densities\pointmass.jl:29  
│    --- the above 2 lines are repeated 39990 more times ---

Julia Version

1.11

ReactiveMP Version

Latest stable

Environment Information

Additional Context

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions