Skip to content

Instantly share code, notes, and snippets.

@akirayou
Last active June 9, 2021 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akirayou/4a37f0d2bf731304df03de8384c9aea1 to your computer and use it in GitHub Desktop.
Save akirayou/4a37f0d2bf731304df03de8384c9aea1 to your computer and use it in GitHub Desktop.
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