LKlinke / Prodigy

A tool that analyses probabilistic programs, allows for automatic invariance checking and handles inference all based on Generatingfunctionology.
Apache License 2.0
2 stars 0 forks source link

ZeroDivision error when trying simple example #21

Closed fzaiser closed 1 year ago

fzaiser commented 1 year ago

I tried the following PGCL program:

nat X;
nat Y;

X := poisson(10);
Y := iid(bernoulli(0.2), X);
observe(Y = 1);
?Ex[X]
!Print

I get the following output:

[...]
  File "[redacted]/Prodigy/prodigy/distribution/generating_function.py", line 823, in normalize
    raise ZeroDivisionError
ZeroDivisionError

Am I doing something wrong?

LKlinke commented 1 year ago

For me this code you presented works fine and outputs

\underbrace{\frac{2XYe^{-10}e^{8 X}}{(2 - e^2)*e^{-2} + 1}}_{\text{SymPy}} = \underbrace{\frac{e^{-10+8X} \cdot Y X}{e^{-2}}}_{\text{GiNaC}}

used commit: a24203c3211e96276c5b371c3a4886a81fc62d60 on branch: new-update

fzaiser commented 1 year ago

Ah, I did not realize I had to use the new-update branch. (I was using main.) On the other branch, it works.