API¶
The page documents the API of PyCmdStan, mostly by pulling docstrings from the sources.
Reading and writing files¶
I/O functions for working with CmdStan executables.
Working with Stan models¶
-
class
pycmdstan.model.
Model
(code: str = None, fname: os.PathLike = None, opt_lvl=3)[source]¶ Stan model.
-
model_id
¶ SHA256 checksum of model code.
-
-
class
pycmdstan.model.
Run
(model: pycmdstan.model.Model, method: str, data: dict = None, id: int = None, log_lik: str = 'log_lik', start: bool = True, wait: bool = False, tmp_dir: str = '', **method_args)[source]¶ -
cmd
¶ Generate the command line for this run.
-
csv
¶ Return output samples.
-
-
class
pycmdstan.model.
RunSet
(*runs)[source]¶ A set of runs.
-
N_Eff
¶ Retrieve vector of all N_eff values.
-
N_Eff_per_iter
¶ Retrieve vector of N_eff / niter.
-
R_hats
¶ Retrive vector of all R_hat values.
-
csv
¶ Return all output samples for Runs in this Runset.
-
flat_field
(field, only_params=True)[source]¶ Collect all values from summary for a given column, e.g. R_hat.
-
summary
¶ Retrive summary results for this RunSet.
-
-
pycmdstan.model.
compile_model
(stan_fname, opt_lvl=3)[source]¶ Compile the given Stan model file to an executable.
-
pycmdstan.model.
model_path
() → str[source]¶ Returns the directory where compiled models should be cached.
Plotting results¶
-
pycmdstan.viz.
hist_key
(csv, *keys)[source]¶ Create a histogram for keys (parameter names) in sample set.
-
pycmdstan.viz.
parallel_coordinates
(csv, keys, marker='ko-')[source]¶ Create a parallel coordinates plot for keys in the given dataset.