Closed sreedta8 closed 3 years ago
Hi,
Unfortunately the yaps wrapper for pycmdstan is far from complete.
However you can easily use the original API using the model
and data
attribute
For instance:
import numpy as np
import pycmdstan
import yaps
from yaps.lib import int, real, uniform, bernoulli
@yaps.model
def coin(x: int(lower=0, upper=1)[10]):
theta: real(lower=0, upper=1) <~ uniform(0, 1)
for i in range(1,11):
x[i] <~ bernoulli(theta)
flips = np.array([0, 1, 0, 0, 0, 0, 0, 0, 0, 1])
constrained_coin = coin(x=flips)
cmdstan_model = pycmdstan.Model(code=str(constrained_coin.model))
run = cmdstan_model.sample(data=constrained_coin.data)
run_set = pycmdstan.model.RunSet(run)
print(run_set.summary)
@gbdrt Thanks again for your clarifying example and code. As I mentioned in the other post, I'm going to develop some examples in Bayesian modeling and reach out to you here so that others can use the yaps
interface you have all developed.
Hi
This is a continuation of my previous question: I began exploring the methods avaiable in pycmdstan such as
pycmdstan.model.stansummary_csv(csv_in)
andpycmdstan.viz.trace_nuts()
to get the model trace plot for all parameters. How can I do that inyaps
model runs?