{"id":13689395,"url":"https://github.com/stan-dev/pystan2","last_synced_at":"2025-05-01T23:34:10.011Z","repository":{"id":8615482,"uuid":"10256919","full_name":"stan-dev/pystan2","owner":"stan-dev","description":"PyStan, the Python interface to Stan","archived":true,"fork":false,"pushed_at":"2021-02-17T17:59:24.000Z","size":55977,"stargazers_count":920,"open_issues_count":0,"forks_count":191,"subscribers_count":51,"default_branch":"develop","last_synced_at":"2024-10-29T14:21:57.176Z","etag":null,"topics":["machine-learning","probabilistic-programming","python","stan","statistics"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stan-dev.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"stan-dev","custom":"https://mc-stan.org/support/"}},"created_at":"2013-05-24T01:21:21.000Z","updated_at":"2024-10-15T12:44:07.000Z","dependencies_parsed_at":"2022-08-27T18:20:14.766Z","dependency_job_id":null,"html_url":"https://github.com/stan-dev/pystan2","commit_stats":null,"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stan-dev%2Fpystan2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stan-dev%2Fpystan2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stan-dev%2Fpystan2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stan-dev%2Fpystan2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stan-dev","download_url":"https://codeload.github.com/stan-dev/pystan2/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224016627,"owners_count":17241714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["machine-learning","probabilistic-programming","python","stan","statistics"],"created_at":"2024-08-02T15:01:46.177Z","updated_at":"2024-11-12T13:31:36.483Z","avatar_url":"https://github.com/stan-dev.png","language":"Python","funding_links":["https://github.com/sponsors/stan-dev","https://mc-stan.org/support/"],"categories":["Python"],"sub_categories":[],"readme":"PyStan: The Python Interface to Stan\n====================================\n\n.. image:: https://raw.githubusercontent.com/stan-dev/logos/master/logo.png\n    :alt: Stan logo\n    :scale: 50 %\n\n|pypi| |travis| |appveyor| |zenodo|\n\n.. tip:: PyStan 3 is available for Linux and macOS users. Visit the `PyStan 3 documentation \u003chttps://pystan.readthedocs.io/en/latest/\u003e`_ for details. PyStan 2 is not maintained.\n\n**PyStan** provides a Python interface to Stan, a package for Bayesian inference\nusing the No-U-Turn sampler, a variant of Hamiltonian Monte Carlo.\n\nFor more information on `Stan \u003chttp://mc-stan.org\u003e`_ and its modeling language,\nsee the Stan User's Guide and Reference Manual at `http://mc-stan.org/\n\u003chttp://mc-stan.org/\u003e`_.\n\n\nImportant links\n---------------\n\n- HTML documentation: https://pystan2.readthedocs.org\n- Issue tracker: https://github.com/stan-dev/pystan/issues\n- Source code repository: https://github.com/stan-dev/pystan\n- Stan: http://mc-stan.org/\n- Stan User's Guide and Reference Manual (pdf) available at http://mc-stan.org\n\nRelated projects\n----------------\n\n- ArviZ: `Exploratory analysis of Bayesian models with Python \u003chttps://github.com/arviz-devs/arviz\u003e`_ by @arviz-devs\n- Jupyter tool: `StanMagic \u003chttps://github.com/Arvinds-ds/stanmagic\u003e`_ by @Arvinds-ds\n- Jupyter tool: `JupyterStan \u003chttps://github.com/janfreyberg/jupyterstan\u003e`_ by @janfreyberg\n- Scikit-learn integration: `pystan-sklearn \u003chttps://github.com/rgerkin/pystan-sklearn\u003e`_ by @rgerkin.\n\nProjects using PyStan\n---------------------\n- BAMBI: `BAyesian Model-Building Interface \u003chttps://github.com/bambinos/bambi\u003e`_ by @bambinos\n- hBayesDM: `hierarchical Bayesian modeling of Decision-Making tasks \u003chttps://hbayesdm.readthedocs.io\u003e`_ by @CCS-Lab\n- Orbit: `Object-oRiented BayesIan Timeseries models \u003chttps://github.com/uber/orbit\u003e`_ by @uber\n- Prophet: `Timeseries forecasting \u003chttps://facebook.github.io/prophet/\u003e`_ by @facebook\n\nSimilar projects\n----------------\n\n- PyMC3: https://docs.pymc.io/\n- emcee: https://emcee.readthedocs.io/en/stable/\n\nPyStan3 / Stan3\n---------------\nThe development of PyStan3 with updated API can be found under `stan-dev/pystan-next \u003chttps://github.com/stan-dev/pystan-next\u003e`_\n\nDetailed Installation Instructions\n----------------------------------\nDetailed installation instructions can be found in the\n`doc/installation_beginner.md \u003cdoc/installation_beginner.rst/\u003e`_ file.\n\nWindows Installation Instructions\n---------------------------------\nDetailed installation instructions for Windows can be found in docs under `PyStan on Windows \u003chttps://pystan2.readthedocs.io/en/latest/windows.html\u003e`_\n\nQuick Installation (Linux and macOS)\n------------------------------------\n\n`NumPy  \u003chttp://www.numpy.org/\u003e`_ and `Cython \u003chttp://www.cython.org/\u003e`_\n(version 0.22 or greater) are required. `matplotlib \u003chttp://matplotlib.org/\u003e`_\nis optional. ArviZ is recommended for visualization and analysis.\n\nPyStan and the required packages may be installed from the `Python Package Index\n\u003chttps://pypi.python.org/pypi\u003e`_ using ``pip``.\n\n::\n\n   pip install pystan\n\nAlternatively, if Cython (version 0.22 or greater) and NumPy are already\navailable, PyStan may be installed from source with the following commands\n\n::\n\n   git clone --recursive https://github.com/stan-dev/pystan.git\n   cd pystan\n   python setup.py install\n\nTo install latest development version user can also use ``pip``\n\n::\n\n    pip install git+https://github.com/stan-dev/pystan\n\nIf you encounter an ``ImportError`` after compiling from source, try changing\nout of the source directory before attempting ``import pystan``. On Linux and\nOS X ``cd /tmp`` will work.\n\n``make`` (``mingw32-make`` on Windows) is a requirement for building from source.\n\nExample\n-------\n\n.. code-block:: python\n\n    import pystan\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    schools_code = \"\"\"\n    data {\n        int\u003clower=0\u003e J; // number of schools\n        real y[J]; // estimated treatment effects\n        real\u003clower=0\u003e sigma[J]; // s.e. of effect estimates\n    }\n    parameters {\n        real mu;\n        real\u003clower=0\u003e tau;\n        real eta[J];\n    }\n    transformed parameters {\n        real theta[J];\n        for (j in 1:J)\n            theta[j] = mu + tau * eta[j];\n    }\n    model {\n        eta ~ normal(0, 1);\n        y ~ normal(theta, sigma);\n    }\n    \"\"\"\n\n    schools_dat = {'J': 8,\n                   'y': [28,  8, -3,  7, -1,  1, 18, 12],\n                   'sigma': [15, 10, 16, 11,  9, 11, 10, 18]}\n\n    sm = pystan.StanModel(model_code=schools_code)\n    fit = sm.sampling(data=schools_dat, iter=1000, chains=4)\n\n    print(fit)\n\n    eta = fit.extract(permuted=True)['eta']\n    np.mean(eta, axis=0)\n\n    # if matplotlib is installed (optional, not required), a visual summary and\n    # traceplot are available\n    fit.plot()\n    plt.show()\n\n    # updated traceplot can be plotted with\n    import arviz as az\n    az.plot_trace(fit)\n\n.. |pypi| image:: https://badge.fury.io/py/pystan.png\n    :target: https://badge.fury.io/py/pystan\n    :alt: pypi version\n\n.. |travis| image:: https://travis-ci.org/stan-dev/pystan.png?branch=master\n    :target: https://travis-ci.org/stan-dev/pystan\n    :alt: travis-ci build status\n\n.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/49e69yl5ngxkpmab?svg=true\n    :target: https://ci.appveyor.com/project/pystan/pystan\n    :alt: appveyor-ci build status\n\n.. |zenodo| image:: https://zenodo.org/badge/10256919.svg\n    :target: https://zenodo.org/badge/latestdoi/10256919\n    :alt: zenodo citation DOI\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstan-dev%2Fpystan2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstan-dev%2Fpystan2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstan-dev%2Fpystan2/lists"}