I am inferring over a discrete space…The support being different possible strings. I have a dict() that represents this distribution, from which I create a Categorical distribution. My likelihood function depends on the string. Consider the code below,
def likelihood(str):
def logp(value):
return
distribution = {"A" : 0.2, "B" = 0.5, "C": 0.3}
with pm.Model() as model:
rv = pm.Categorical("RV", list(distribution.values()))
like = pm.DensityDist("like", likelihood(list(distribution.keys())[rv]), observed=obs)
I get the following error,
TypeError: list indices must be integers or slices, not FreeRV
Any help is appreciated!