Hi, I am trying to compute log density manually using pystan 3.5, but keep getting error message . Can anyone check where my test codes in python go wrong or offer any example codes about it? I really appreciate your help!
def my_log_prob(x, data, seed, modelDir, modelName):
with open(os.path.join(modelDir, modelName + ".stan")) as f:
modelCode = f.read()
posterior = stan.build(program_code = modelCode, data = data[modelName], random_seed = seed)
unconstrained_parms = posterior.unconstrain_pars(constrained_parameters = x)
The parameter x here is a list of dictionary of fixed parameters. And the error message is the following:
Object of type ndarray is not JSON serializable