Trying to adapt the initial coin-flip example on RxInfer to model a weighted die

Hi all,

I’m completely new to Julia and I apologize if this is a naive question, but I have been attempting to model a weighted die using RxInfer. I’ve followed the same structure as the coin_toss example provide in the RxInfer getting-started page but can’t seem to get it to work.

The issue seems to arise when I actually try to use the “infer” function, which throws the error: ERROR: probvec(::PointMass{ <: Real }) is not defined

I would really appreciate any help with this. I’ve attached the minimal amount of code to reproduce this below:

using RxInfer, Distributions, Random
using Cairo, GraphPlot, Plots #for graph visuals

#initial parameters
rng = MersenneTwister(20)

n_10 = 10
die_weightings = [0.05, 0.05, 0.05, 0.283, 0.283, 0.284]
distribution = Categorical(die_weightings)
dataset = rand(rng, distribution, n_10)

@model function die_model(y, α)
p ~ Dirichlet(α)
y .~ Categorical(p) # 6-sided die
end

result = infer(
model = die_model(α = ones(6)),
data = (y = dataset,)
)

Thanks!

P.S: Conditioning and visualizing the model seems to work as intended even with deferred data:

conditioned_with_deffered_data = die_model() | (
y = [ 4, 1, 6 ],
α = RxInfer.DeferredDataHandler(),
)

model_with_deffered_data = RxInfer.create_model(conditioned_with_deffered_data)
GraphPlot.gplot(RxInfer.getmodel(model_with_deffered_data))

Thank you.

Welcome! You could also try asking in RxInfer.jl GitHub discussions or issues like the error message suggests. I’m not very familiar with this but feels there is no simple mistake here.

Thank you, I might try the RxInfer github.

Much appreciated