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

**URL:** https://discourse.julialang.org/t/trying-to-adapt-the-initial-coin-flip-example-on-rxinfer-to-model-a-weighted-die/131960
**Category:** New to Julia
**Created:** [August 30, 2025, 1:48am UTC](https://discourse.julialang.org/t/trying-to-adapt-the-initial-coin-flip-example-on-rxinfer-to-model-a-weighted-die/131960 "2025-08-30T01:48:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![B\_S](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@B\_S](https://discourse.julialang.org/u/B_S)
#### Post date: [August 30, 2025, 1:48am UTC](https://discourse.julialang.org/t/trying-to-adapt-the-initial-coin-flip-example-on-rxinfer-to-model-a-weighted-die/131960/1 "2025-08-30T01:48:53Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![eteppo](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@eteppo](https://discourse.julialang.org/u/eteppo)
#### Post date: [August 31, 2025, 10:05am UTC](https://discourse.julialang.org/t/trying-to-adapt-the-initial-coin-flip-example-on-rxinfer-to-model-a-weighted-die/131960/2 "2025-08-31T10:05:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![B\_S](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@B\_S](https://discourse.julialang.org/u/B_S)
#### Post date: [September 1, 2025, 10:23am UTC](https://discourse.julialang.org/t/trying-to-adapt-the-initial-coin-flip-example-on-rxinfer-to-model-a-weighted-die/131960/3 "2025-09-01T10:23:14Z")

</div>

Thank you, I might try the RxInfer github.

Much appreciated
