pystan

PyStan, a Python interface to Stan, a platform for statistical modeling. Documentation: https://pystan.readthedocs.io

https://github.com/stan-dev/pystan

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    6 of 16 committers (37.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.7%) to scientific vocabulary

Keywords from Contributors

closember bayes posterior
Last synced: 10 months ago · JSON representation

Repository

PyStan, a Python interface to Stan, a platform for statistical modeling. Documentation: https://pystan.readthedocs.io

Basic Info
  • Host: GitHub
  • Owner: stan-dev
  • License: isc
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 219 KB
Statistics
  • Stars: 354
  • Watchers: 14
  • Forks: 60
  • Open Issues: 13
  • Releases: 0
Created almost 9 years ago · Last pushed about 2 years ago
Metadata Files
Readme Funding License

README.rst

******
PyStan
******

**PyStan** is a Python interface to Stan, a package for Bayesian inference.

Stan® is a state-of-the-art platform for statistical modeling and
high-performance statistical computation. Thousands of users rely on Stan for
statistical modeling, data analysis, and prediction in the social, biological,
and physical sciences, engineering, and business.

Notable features of PyStan include:

* Automatic caching of compiled Stan models
* Automatic caching of samples from Stan models
* An interface similar to that of RStan
* Open source software: ISC License

Getting started
===============

Install PyStan with ``pip install pystan``. PyStan runs on Linux and macOS. You will also need a C++ compiler such as gcc ≥9.0 or clang ≥10.0.

The following block of code shows how to use PyStan with a model which studied coaching effects across eight schools (see Section 5.5 of Gelman et al (2003)). This hierarchical model is often called the "eight schools" model.

.. code-block:: python

    import stan

    schools_code = """
    data {
      int J;         // number of schools
      array[J] real y;              // estimated treatment effects
      array[J] real sigma; // standard error of effect estimates
    }
    parameters {
      real mu;                // population treatment effect
      real tau;      // standard deviation in treatment effects
      vector[J] eta;          // unscaled deviation from mu by school
    }
    transformed parameters {
      vector[J] theta = mu + tau * eta;        // school treatment effects
    }
    model {
      target += normal_lpdf(eta | 0, 1);       // prior log-density
      target += normal_lpdf(y | theta, sigma); // log-likelihood
    }
    """

    schools_data = {"J": 8,
                    "y": [28,  8, -3,  7, -1,  1, 18, 12],
                    "sigma": [15, 10, 16, 11,  9, 11, 10, 18]}

    posterior = stan.build(schools_code, data=schools_data)
    fit = posterior.sample(num_chains=4, num_samples=1000)
    eta = fit["eta"]  # array with shape (8, 4000)
    df = fit.to_frame()  # pandas `DataFrame`


Citation
========

We appreciate citations as they let us discover what people have been doing
with the software. Citations also provide evidence of use which can help in
obtaining grant funding.

To cite PyStan in publications use:

Riddell, A., Hartikainen, A., & Carter, M. (2021). PyStan (3.0.0). https://pypi.org/project/pystan

Or use the following BibTeX entry::

    @misc{pystan,
      title = {pystan (3.0.0)},
      author = {Riddell, Allen and Hartikainen, Ari and Carter, Matthew},
      year = {2021},
      month = mar,
      howpublished = {PyPI}
    }

Please also cite Stan.

Owner

  • Name: Stan
  • Login: stan-dev
  • Kind: organization
  • Email: mc.stanislaw@gmail.com

GitHub Events

Total
  • Issues event: 1
  • Watch event: 19
  • Issue comment event: 2
  • Fork event: 4
Last Year
  • Issues event: 1
  • Watch event: 19
  • Issue comment event: 2
  • Fork event: 4

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 237
  • Total Committers: 16
  • Avg Commits per committer: 14.813
  • Development Distribution Score (DDS): 0.114
Past Year
  • Commits: 20
  • Committers: 3
  • Avg Commits per committer: 6.667
  • Development Distribution Score (DDS): 0.15
Top Committers
Name Email Commits
Allen Riddell r****n@i****u 210
Ari Hartikainen h****i@g****m 5
Matthew Carter m****2@l****k 5
Ari Hartikainen a****n@r****i 4
Ari Hartikainen a****n 2
A. Riddell r****a@i****u 1
Anthony Sottile a****e@u****u 1
Hartikainen Ari a****n@a****i 1
Javier Burroni j****i@g****m 1
Jonah Gabry j****y@g****m 1
Michael Clerx m****x@n****k 1
Semyeong Oh s****h@g****m 1
ahartikainen a****n@g****m 1
amas a****1@g****m 1
er-eis e****0@g****m 1
mikediessner m****2@n****k 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 77
  • Total pull requests: 48
  • Average time to close issues: 2 months
  • Average time to close pull requests: 16 days
  • Total issue authors: 48
  • Total pull request authors: 13
  • Average comments per issue: 3.21
  • Average comments per pull request: 1.17
  • Merged pull requests: 33
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 2.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • riddell-stan (15)
  • ahartikainen (11)
  • beew (2)
  • mrv-king (2)
  • ForceBru (2)
  • MichaelClerx (2)
  • ansarrice (2)
  • BrandonReeve (1)
  • coenvdm (1)
  • rrod515 (1)
  • W-L-W (1)
  • loulakiX (1)
  • 8one6 (1)
  • ideasrule (1)
  • adaly (1)
Pull Request Authors
  • riddell-stan (34)
  • afuetterer (4)
  • ahartikainen (3)
  • abelowska (2)
  • monikavila (2)
  • cclauss (1)
  • thechopkins (1)
  • tillahoffmann (1)
  • MichaelClerx (1)
  • seeky-camelid (1)
  • er-eis (1)
  • asottile (1)
Top Labels
Issue Labels
bug (40) wontfix (24) help wanted (3) enhancement (3) question (1)
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 595,958 last-month
  • Total docker downloads: 5,321,880
  • Total dependent packages: 42
    (may contain duplicates)
  • Total dependent repositories: 1,424
    (may contain duplicates)
  • Total versions: 83
  • Total maintainers: 2
pypi.org: pystan

Python interface to Stan, a package for Bayesian inference

  • Versions: 67
  • Dependent Packages: 35
  • Dependent Repositories: 1,380
  • Downloads: 595,958 Last month
  • Docker Downloads: 5,321,880
Rankings
Downloads: 0.3%
Dependent repos count: 0.3%
Dependent packages count: 0.5%
Docker downloads count: 0.6%
Average: 1.8%
Stargazers count: 3.7%
Forks count: 5.7%
Maintainers (2)
Last synced: 10 months ago
conda-forge.org: pystan

PyStan provides a Python interface to Stan, a package for Bayesian inference using the No-U-Turn sampler, a variant of Hamiltonian Monte Carlo.

  • Versions: 10
  • Dependent Packages: 7
  • Dependent Repositories: 22
Rankings
Dependent repos count: 7.6%
Dependent packages count: 8.0%
Average: 16.5%
Stargazers count: 24.1%
Forks count: 26.1%
Last synced: 10 months ago
anaconda.org: pystan

PyStan provides a Python interface to Stan, a package for Bayesian inference using the No-U-Turn sampler, a variant of Hamiltonian Monte Carlo.

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 22
Rankings
Dependent repos count: 30.9%
Stargazers count: 36.7%
Forks count: 38.7%
Average: 39.3%
Dependent packages count: 51.0%
Last synced: 11 months ago

Dependencies

docs-requirements.txt pypi
  • sphinx *
  • sphinx-rtd-theme *
pyproject.toml pypi
  • autoflake ^1.4 develop
  • black 22.6.0 develop
  • flake8 ^4.0 develop
  • isort ^5.9 develop
  • mypy 0.961 develop
  • pandas ^1.0 develop
  • pytest ^6.2 develop
  • pytest-asyncio ^0.18.3 develop
  • sphinx ^4.2 develop
  • sphinx-rtd-theme ^1.0 develop
  • types-setuptools ^57.4 develop
  • aiohttp ^3.6
  • clikit ^0.6
  • httpstan ~4.8
  • numpy ^1.19
  • pysimdjson ^3.2
  • python ^3.8
  • setuptools *
.github/workflows/main.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/publish.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite