Hello,
I’m trying to implement the following generative process.
ζ, an integer from 0 to 100, is given some prior.
r|ζ is sampled as follows:
- If ζ is outside the interval [65,75], then return ζ.
- Otherwise, with probability 0.8 return 70, and with probability 0.2 return ζ.
The closest implementation I’ve come up with is:
refined_model = pymc3.Model()
with refined_model:
ζ = pymc3.Binomial(‘ζ’, n=100, p=0.6)
m = pymc3.Mixture(‘m’, w = [0.8, 0.2], comp_dists = [
pymc3.ConstantDist.dist(c = 70),
pymc3.ConstantDist.dist(c = ζ),
])
r = pymc3.switch(pymc3.math.and_(pymc3.math.gt(ζ,65), pymc3.math.lt(ζ,75)), m, ζ)
obs_noisy = Normal(‘obs_noisy’, mu = r, sd=1, observed = lazified_votes)
but this fails with:
TypeError: For compute_test_value, one input test value does not have the requested type.
The error when converting the test value to that variable type:
Wrong number of dimensions: expected 0, got 1 with shape (2,).
How can I model this?