Hello everyone! I’m setting up an experiment in which raters have to evaluate whether something is ‘1’ or ‘0’, and am trying to infer the proportion p of ‘1’ in the population of things that are evaluated. The problem is that raters have a certain probability of making type I and II errors, so those have to be estimated as well.
I was considering estimating p and the error probabilities of raters using a bayesian network, and have written the following code:
@as_op(itypes=[tt.dscalar, tt.dscalar, tt.lscalar], otypes=[tt.dscalar])
def rater(alpha, beta, rel):
if (rel == 1):
return (1 - beta)
else:
return (alpha)
with pm.Model() as generate_net:
#we know from earlier research that the p is probably rather low
p = pm.Beta('p',2,5)
#uniform priors for the errors
#assume for now that alpha and beta are the same for our two raters
alpha =pm.Beta('alpha',1,1)
beta =pm.Beta('beta',1,1)
relevance = pm.Bernoulli('relevance', p = p)
rater1 = pm.Bernoulli('rater1', p = rater(alpha, beta, relevance), observed = rater1_data)
rater2 = pm.Bernoulli('rater2', p = rater(alpha, beta, relevance), observed = rater2_data)
rater1_data and rater2_data are just arrays of 1’s and 0’s. Unfortunately, when I try sampling, I get a SamplingError: Bad initial energy
. Looking for a solution, I encountered this thread on bayes nets in PyMC3, and now have two questions:
- Is it possible to run this kind of model in PyMC3, and what might I be doing wrong?
- Can anyone recommend other python tools I might use. I know there’s various options around (Pomegranate, Pgmpy, Edward, Pyro) but have experience with neither and find it hard to choose.
thanks!