Last active
June 9, 2021 01:02
-
-
Save akirayou/4a37f0d2bf731304df03de8384c9aea1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cmdstanpy import CmdStanModel | |
import os | |
with open("test.stan","w") as f: | |
print(""" | |
data { | |
} | |
parameters { | |
real A; | |
} | |
model { | |
A ~ normal(0,1); | |
if(1<A)reject("to put some message to stderr"); | |
} | |
""",file=f) | |
os.environ["CXX"]="g++" | |
stanModel = CmdStanModel(stan_file="test.stan") | |
fit=stanModel.sample(data={},iter_warmup=100,iter_sampling=10000,show_progress=True) #or show_prgress="notebook" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment