Skip to main content

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()

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)

Source distribution for cmdstanpy 0.6.0
File Size Uploaded
cmdstanpy-0.6.0.tar.gz 39.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cmdstanpy 0.6.0
File Interpreter ABI Platform
cmdstanpy-0.6.0-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

1.3.0

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.77

2 release files

0.9.76

2 release files

0.9.75

2 release files

0.9.68

2 release files

0.9.67

1 release file

0.9.6

2 release files

0.9.5

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page