Skip to content

Instantly share code, notes, and snippets.

@akirayou
Last active Jun 9, 2021
Embed
What would you like to do?
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