CmdStanPy
CmdStanPy is a lightweight interface to Stan for Python users which provides the necessary objects and functions to compile a Stan program and run Stan's samplers.
Goals
-
Clean interface to Stan services so that CmdStanPy can keep up with Stan releases.
-
Provides complete control - all sampler arguments have corresponding named argument for CmdStanPy sampler function.
-
Easy to install,
- minimal Python library dependencies: numpy, pandas
- Python code doesn't interface directly with c++, only calls compiled executables
-
Modular - CmdStanPy produces a sample from the posterior, downstream modules do the analysis.
Docs
See https://cmdstanpy.readthedocs.io/en/latest/index.html
Source Repository
CmdStan's source-code repository is hosted here on GitHub.
Licensing
The CmdStanPy, CmdStan, and the core Stan C++ code are licensed under new BSD.
Example
::
import os
from cmdstanpy import CmdStanModel, cmdstan_path
# specify Stan file, create, compile CmdStanModel object
bernoulli_path = os.path.join(cmdstan_path(), 'examples', 'bernoulli', 'bernoulli.stan')
bernoulli_model = CmdStanModel(stan_file=bernoulli_path)
bernoulli_model.compile()
# specify data, fit the model
bernoulli_data = { "N" : 10, "y" : [0,1,0,0,0,0,0,0,0,1] }
bernoulli_fit = bernoulli_model.sample(chains=5, cores=3, data=bernoulli_data)
# summarize the results (wraps CmdStan `bin/stansummary`):
bernoulli_fit.summary()
Metadata
Release files for cmdstanpy 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cmdstanpy-0.6.0.tar.gz | 39.3 kB | Without provenance | Details for cmdstanpy-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cmdstanpy-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for cmdstanpy-0.6.0-py3-none-any.whl |
Total release size: 73.1 kB
Release files / cmdstanpy-0.6.0.tar.gz
| Download URL | cmdstanpy-0.6.0.tar.gz |
|---|---|
| Size | 39.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69b2e343a7f1cdaff5c6efe3f9df68680845a7096402993a8f40030dde09cb9f
|
|
BLAKE2b-256 checksum How to use checksums |
4fe73ecfaa22ce8c417f128bdb38716244bfadd8f657025b7d15226d9ce8377a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.0
|
Release files / cmdstanpy-0.6.0-py3-none-any.whl
| Download URL | cmdstanpy-0.6.0-py3-none-any.whl |
|---|---|
| Size | 33.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17bcddecab826e6a6c29c2c255cdc378733da4c4fa485c0cd31a83c7fea918ed
|
|
BLAKE2b-256 checksum How to use checksums |
60f532f7b4844a0f4e3794f3456ab3ba73fe869ce7043977fcd39c7b75d06c1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.0
|
Security for cmdstanpy 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.