I’m following the guide code here(V3) to implement a custom distribution that draws two variables from a joint distribution. I’m trying to draw from it and I’m getting the below error under V4
def pc_prior_logp(values, ktype, eta_upper, alpha_eta, rho_lower, alpha_rho):
degree = ktype + 0.5
eta = values[0]
kappa = values[2]
lambda1 = -np.log(alpha_rho) * np.sqrt(rho_lower / np.sqrt(8 * degree))
lambda2 = -np.log(alpha_eta) / eta_upper
return np.log(0.5) + np.log(lambda1) - 0.5*np.log(kappa) - lambda1*np.sqrt(kappa) + \
np.log(lambda2) - lambda2*eta
pm_model = pm.Model(check_bounds= False)
with pm_model as model:
# lambda_icept = pm.Normal('lambda_icept', mu = 0, sigma = 5, shape = B-1)
hypers0_icept = pm.DensityDist('hypers0_icept', ktype, 5, 0.02, 0.2*P, 0.001, logp = pc_prior_logp, shape = 2, testval = [1,1])
prior_checks = pm.sample_prior_predictive(samples=50, random_seed=RANDOM_SEED)
"name": "NotImplementedError",
"message": "Attempted to run random on the DensityDist 'hypers0_icept', but this method had not been provided when the distribution was constructed. Please re-build your model and provide a callable to 'hypers0_icept's random keyword argument.
Furthermore, I’m a bit confused about the ‘observed’ kwarg. I know all the arguments of pc_prior_logp as fixed values except values, which is a tuple of eta/kappa that I’m attempting to draw from the distribution. Not sure if I should be using observed.