cmdstanpy


Namecmdstanpy JSON
Version 1.2.4 PyPI version JSON
download
home_pageNone
SummaryPython interface to CmdStan
upload_time2024-06-17 14:29:40
maintainerNone
docs_urlNone
authorStan Dev Team
requires_python>=3.8
licenseBSD-3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CmdStanPy

[![codecov](https://codecov.io/gh/stan-dev/cmdstanpy/branch/master/graph/badge.svg)](https://codecov.io/gh/stan-dev/cmdstanpy)


CmdStanPy is a lightweight pure-Python interface to CmdStan which provides access to the Stan compiler and all inference algorithms.  It supports both development and production workflows. Because model development and testing may require many iterations, the defaults favor development mode and therefore output files are stored on a temporary filesystem. Non-default options allow all aspects of a run to be specified so that scripts can be used to distributed analysis jobs across nodes and machines.

CmdStanPy is distributed via PyPi: https://pypi.org/project/cmdstanpy/

or Conda Forge: https://anaconda.org/conda-forge/cmdstanpy

### Goals

- Clean interface to Stan services so that CmdStanPy can keep up with Stan releases.

- Provide access to all CmdStan inference methods.

- 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 MCMC sample (or point estimate) from the posterior; other packages do analysis and visualization.

- Low memory overhead - by default, minimal memory used above that required by CmdStanPy; objects run CmdStan programs and track CmdStan input and output files.


### Source Repository

CmdStanPy and CmdStan are available from GitHub: https://github.com/stan-dev/cmdstanpy and https://github.com/stan-dev/cmdstan


### Docs

The latest release documentation is hosted on  https://mc-stan.org/cmdstanpy, older release versions are available from readthedocs:  https://cmdstanpy.readthedocs.io

### Licensing

The CmdStanPy, CmdStan, and the core Stan C++ code are licensed under new BSD.

### Example

```python
import os
from cmdstanpy import cmdstan_path, CmdStanModel

# specify locations of Stan program file and data
stan_file = os.path.join(cmdstan_path(), 'examples', 'bernoulli', 'bernoulli.stan')
data_file = os.path.join(cmdstan_path(), 'examples', 'bernoulli', 'bernoulli.data.json')

# instantiate a model; compiles the Stan program by default
model = CmdStanModel(stan_file=stan_file)

# obtain a posterior sample from the model conditioned on the data
fit = model.sample(chains=4, data=data_file)

# summarize the results (wraps CmdStan `bin/stansummary`):
fit.summary()
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cmdstanpy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Stan Dev Team",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/26/cc/42b48308bc95c6387d81da7b96aaa6c0030b6a1bc7fbcd32de9062d5ab5f/cmdstanpy-1.2.4.tar.gz",
    "platform": null,
    "description": "# CmdStanPy\n\n[![codecov](https://codecov.io/gh/stan-dev/cmdstanpy/branch/master/graph/badge.svg)](https://codecov.io/gh/stan-dev/cmdstanpy)\n\n\nCmdStanPy is a lightweight pure-Python interface to CmdStan which provides access to the Stan compiler and all inference algorithms.  It supports both development and production workflows. Because model development and testing may require many iterations, the defaults favor development mode and therefore output files are stored on a temporary filesystem. Non-default options allow all aspects of a run to be specified so that scripts can be used to distributed analysis jobs across nodes and machines.\n\nCmdStanPy is distributed via PyPi: https://pypi.org/project/cmdstanpy/\n\nor Conda Forge: https://anaconda.org/conda-forge/cmdstanpy\n\n### Goals\n\n- Clean interface to Stan services so that CmdStanPy can keep up with Stan releases.\n\n- Provide access to all CmdStan inference methods.\n\n- Easy to install,\n  + minimal Python library dependencies: numpy, pandas\n  + Python code doesn't interface directly with c++, only calls compiled executables\n\n- Modular - CmdStanPy produces a MCMC sample (or point estimate) from the posterior; other packages do analysis and visualization.\n\n- Low memory overhead - by default, minimal memory used above that required by CmdStanPy; objects run CmdStan programs and track CmdStan input and output files.\n\n\n### Source Repository\n\nCmdStanPy and CmdStan are available from GitHub: https://github.com/stan-dev/cmdstanpy and https://github.com/stan-dev/cmdstan\n\n\n### Docs\n\nThe latest release documentation is hosted on  https://mc-stan.org/cmdstanpy, older release versions are available from readthedocs:  https://cmdstanpy.readthedocs.io\n\n### Licensing\n\nThe CmdStanPy, CmdStan, and the core Stan C++ code are licensed under new BSD.\n\n### Example\n\n```python\nimport os\nfrom cmdstanpy import cmdstan_path, CmdStanModel\n\n# specify locations of Stan program file and data\nstan_file = os.path.join(cmdstan_path(), 'examples', 'bernoulli', 'bernoulli.stan')\ndata_file = os.path.join(cmdstan_path(), 'examples', 'bernoulli', 'bernoulli.data.json')\n\n# instantiate a model; compiles the Stan program by default\nmodel = CmdStanModel(stan_file=stan_file)\n\n# obtain a posterior sample from the model conditioned on the data\nfit = model.sample(chains=4, data=data_file)\n\n# summarize the results (wraps CmdStan `bin/stansummary`):\nfit.summary()\n```\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Python interface to CmdStan",
    "version": "1.2.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/stan-dev/cmdstanpy/issues",
        "Homepage": "https://github.com/stan-dev/cmdstanpy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d126522f3de83ca690aa52f4b8c88a1e203abb1e2d75c31669dc004949143cd",
                "md5": "e578735ab2b1ca04e53c67b46041e26c",
                "sha256": "ad60f8ca17050216ab7140e13aa493628d88af8a689f17253a5ad294a9826c78"
            },
            "downloads": -1,
            "filename": "cmdstanpy-1.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e578735ab2b1ca04e53c67b46041e26c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 94486,
            "upload_time": "2024-06-17T14:29:38",
            "upload_time_iso_8601": "2024-06-17T14:29:38.333006Z",
            "url": "https://files.pythonhosted.org/packages/5d/12/6522f3de83ca690aa52f4b8c88a1e203abb1e2d75c31669dc004949143cd/cmdstanpy-1.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "26cc42b48308bc95c6387d81da7b96aaa6c0030b6a1bc7fbcd32de9062d5ab5f",
                "md5": "74d31cdf7cc225089ebf3b4817852fe2",
                "sha256": "ad586be0b9f4c654ecbdc4af4541f4d282f99175956cda88cc5eb873719356cc"
            },
            "downloads": -1,
            "filename": "cmdstanpy-1.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "74d31cdf7cc225089ebf3b4817852fe2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 114097,
            "upload_time": "2024-06-17T14:29:40",
            "upload_time_iso_8601": "2024-06-17T14:29:40.277504Z",
            "url": "https://files.pythonhosted.org/packages/26/cc/42b48308bc95c6387d81da7b96aaa6c0030b6a1bc7fbcd32de9062d5ab5f/cmdstanpy-1.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-17 14:29:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "stan-dev",
    "github_project": "cmdstanpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cmdstanpy"
}
        
Elapsed time: 0.47883s