Cmdstan的Python接口
pycmdstan的Python项目详细描述
Pycmdstan
与Cmdstan的Python接口。
用法
在安装pip install -U pycmdstan
之后,一个人为的例子是
frompycmdstanimportModel,Runmodel=Model('''data { vector[20] x; real mu; }parameters { real sig; }model { x ~ normal(mu, sig); }''')assertmodel.sample(data={'mu':5.0,x:randn(20)},chains=4).R_hat.max()<1.2
有关详细信息,请参见docs。
贡献
欢迎投稿,请从问题追踪开始。 使用yapf格式化代码。dockerfile可以简化本地开发,
docker build -t pycmdstan .
docker run --rm -it pycmdstan pytest -n4 pycmdstan/tests.py
致谢
- psis代码由aki vehtari&tuomas sivula(bsd许可,repo here)