Bernoulli Distribution issues when using Data class

Here is a rather different example that also fails with similar errors. I have changed the Bernoulli to a Normal and also omitted the normally distributed parameter, Y, replacing it with a simple deterministic variable, temp to investigate whether the error required a second observed parameter.

This example runs for me as soon as you comment out the temp = pm.Deterministic('temp', a1 * X) line, suggesting that it’s the dependency (of temp) on an observed parameter (on X) that uses pm.Data().

x = [0,1]
with pm.Model() as model:
    x_data = pm.Data('x_data', x)
    #X = pm.Bernoulli('X', p=0.5, observed=x_data)
    X = pm.Normal('X', 0, 1, observed=x_data)
    a1 = pm.Normal('a1', 0, 5)
    temp = pm.Deterministic('temp', a1 * X)
    trace = pm.sample()

When you open an issue, can you link to it here so that others can find their way to that discussion as well?

1 Like