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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmdstanpy-0.6.0.tar.gz (39.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cmdstanpy-0.6.0-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file cmdstanpy-0.6.0.tar.gz.

File metadata

  • Download URL: cmdstanpy-0.6.0.tar.gz
  • Upload date:
  • Size: 39.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for cmdstanpy-0.6.0.tar.gz
Algorithm Hash digest
SHA256 69b2e343a7f1cdaff5c6efe3f9df68680845a7096402993a8f40030dde09cb9f
MD5 6b176b1c6d915f46df6500f75838262c
BLAKE2b-256 4fe73ecfaa22ce8c417f128bdb38716244bfadd8f657025b7d15226d9ce8377a

See more details on using hashes here.

File details

Details for the file cmdstanpy-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: cmdstanpy-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 33.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for cmdstanpy-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17bcddecab826e6a6c29c2c255cdc378733da4c4fa485c0cd31a83c7fea918ed
MD5 394576f132f7601e29362de1b899a210
BLAKE2b-256 60f532f7b4844a0f4e3794f3456ab3ba73fe869ce7043977fcd39c7b75d06c1c

See more details on using hashes here.

Release history Release notifications | RSS feed

1.3.0

2 files

1.2.5

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.9.77

2 files

0.9.76

2 files

0.9.75

2 files

0.9.68

2 files

0.9.67

1 file

0.9.66

2 files

0.9.65

2 files

0.9.64

2 files

0.9.63

2 files

0.9.62

2 files

0.9.61

2 files

0.9.6

2 files

0.9.5

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

This release

0.6.0 This release

2 files

0.5.0

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page