diff --git a/docs/search.json b/docs/search.json index c84309d..7dfd3eb 100644 --- a/docs/search.json +++ b/docs/search.json @@ -202,7 +202,7 @@ "href": "week1.html#things-to-set-up", "title": "Introduction to Bayesian inference", "section": "Things to set up", - "text": "Things to set up\n\nPython\nFirst get a recent (ideally 3.11+) version of Python This can be very annoying so talk to me if necessary!\nNext get used to Python virtual environments.\nThe method I like is to put the virtual environment in a folder .venv inside the root of my project:\n$ python -m venv .venv --prompt=bscb\nThen to use: Tip: use an ergonomic alias to activate venvs e.g. alias va=\"source .venv/bin/activate\"\n$ source .venv/bin/activate\n# ... do work\n$ deactivate\n\n\nGit and ssh\ngit clone git@github.com:teddygroves/bayesian_statistics_for_systems_biologists.git\n\n\nCmdstanpy and cmdstan\nfrom cmdstanpy import CmdStanModel\nfilename = \"example_stan_program.stan\" \ncode = \"data {} parameters {real t;} model {t ~ std_normal();}\"\nwith open(filename, \"w\") as f:\n f.write(code)\nmodel = CmdStanModel(stan_file=filename)\nmcmc = model.sample()", + "text": "Things to set up\n\nPython\nFirst get a recent (ideally 3.11+) version of Python This can be very annoying so talk to me if necessary!\nNext get used to Python virtual environments.\nThe method I like is to put the virtual environment in a folder .venv inside the root of my project:\n$ python -m venv .venv --prompt=bscb\nThen to use: Tip: use an ergonomic alias to activate venvs e.g. alias va=\"source .venv/bin/activate\"\n$ source .venv/bin/activate\n# ... do work\n$ deactivate\n\n\nGit and ssh\ngit clone git@github.com:teddygroves/bayesian_statistics_for_systems_biologists.git\n\n\nCmdstanpy and cmdstan\nFirst install them:\n$ pip install cmdstanpy\n$ python -m cmdstanpy.instsall_cmdstan\nNow test if they work\nfrom cmdstanpy import CmdStanModel\nfilename = \"example_stan_program.stan\" \ncode = \"data {} parameters {real t;} model {t ~ std_normal();}\"\nwith open(filename, \"w\") as f:\n f.write(code)\nmodel = CmdStanModel(stan_file=filename)\nmcmc = model.sample()", "crumbs": [ "Course materials", "Introduction to Bayesian inference" diff --git a/docs/week1.html b/docs/week1.html index 2f5b280..1c43b96 100644 --- a/docs/week1.html +++ b/docs/week1.html @@ -5253,13 +5253,17 @@
from cmdstanpy import CmdStanModel
-= "example_stan_program.stan"
- filename = "data {} parameters {real t;} model {t ~ std_normal();}"
- code with open(filename, "w") as f:
-
- f.write(code)= CmdStanModel(stan_file=filename)
- model = model.sample() mcmc
First install them:
+$ pip install cmdstanpy
+$ python -m cmdstanpy.instsall_cmdstan
+Now test if they work
+from cmdstanpy import CmdStanModel
+= "example_stan_program.stan"
+ filename = "data {} parameters {real t;} model {t ~ std_normal();}"
+ code with open(filename, "w") as f:
+
+ f.write(code)= CmdStanModel(stan_file=filename)
+ model = model.sample() mcmc