Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The PERT example in the documentation does not work #240

Closed
rlouf opened this issue Mar 10, 2023 · 1 comment · Fixed by #242
Closed

The PERT example in the documentation does not work #240

rlouf opened this issue Mar 10, 2023 · 1 comment · Fixed by #242
Labels
bug Something isn't working

Comments

@rlouf
Copy link
Member

rlouf commented Mar 10, 2023

When I execute the following code copy-pasted in the documentation at the last commit on main:

import aeppl
import aesara
import aesara.tensor as at

srng = at.random.RandomStream()

def pert(srng, a, b, c):
    r"""Construct a random variable that is PERT-distributed."""
    alpha = 1 + 4 * (b - a) / (c - a)
    beta = 1 + 4 * (c - b) / (c - a)

    X_rv = srng.beta(alpha, beta)

    z = a + (b - a) * X_rv

    return z

A_rv = srng.uniform(10, 20, name="A")
B_rv = srng.uniform(20, 65, name="B")
C_rv = srng.uniform(65, 100, name="C")
Y_rv = pert(srng, A_rv, B_rv, C_rv)

logprob, (y_vv, a_vv, b_vv, c_vv) = aeppl.joint_logprob(Y_rv, A_rv, B_rv, C_rv)

I get the error:

aeppl.joint_logprob.DensityNotFound: Couldn't derive a log-probability for Elemwise{add,no_inplace}(ValuedVariable.out, Elemwise{mul,no_inplace}.0)

I get similar errors if I simplify the example:

import aeppl
import aesara.tensor as at

srng = at.random.RandomStream(0)

A_rv = srng.uniform(10, 20, name="A")
X_rv = srng.beta(1., 1.)
Z_rv = A_rv - X_rv

logprob, (z_vv, a_vv) = aeppl.joint_logprob(Z_rv, A_rv)
@rlouf rlouf added the bug Something isn't working label Mar 10, 2023
@brandonwillard
Copy link
Member

My guess is that it's due to changes introduced by #78.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants