-
|
my attempt to use a distribution as data sample failed, when trying to build a hierarchical NormalMixture model. @model function data_as_dist_example(x)
z ~ NormalMeanVariance(0,1)
x ~ NormalMeanVariance(z, 1)
end
result = infer(
model = data_as_dist_example(),
data = (x = NormalMeanVariance(1,1),),
predictvars = (x = KeepEach(),)
)#### error message ####
error: Stacktrace:
[1] mean(fn:typeof(identity), distribution: :PointMass{MvNormalMeanPrecision{Float64, Vector{Float64}, Matrix{Float64}}}) @ BayesBase ~\.julia\packages\BayesBase\THarC\src\densities\pointmass.jl:29
[2] mean(itr:PointMass{MvNormalMeanPrecision{Float64, Vector{Float64}, Matrix{Float64}}}) @ Statistics ~\.julia\packages\Statistics\gbcbG\src\Statistics.jl:44
#### debug info ####
@rule NormalMeanVariance (:μ, Marginalisation) (("marginal_out", "marginal_v")) - ReactiveMP.jl/src/message.jl
q_out: PointMass{NormalMeanVariance{Float64}}(NormalMeanVariance{Float64}(μ=1.0, v=1.0))
q_v: PointMass{Int64}(1)Note: I added |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
If I understand correctly, you are trying to pass an observation for the random variable The |
Beta Was this translation helpful? Give feedback.
Hi Carlo,
thanks a lot for your answer. you made me rethink and reflect my question. i guess my initial question was actually quite confusing and not really making sense since i mixed up a message of a variable vs. a variable node. the solution you proposed is pretty much sampling from the distribution and using that as input data - thats a very neat idea, but not directly what i was looking for. my goal was not to use a pointmass but rather the combination of mean with variance to cluster several distributions.
i now understood i could simply pass it as a message by introducing another factor node, where we define the parameters with the "data":