1Metadata-Version: 1.1 2Name: pystan 3Version: 2.19.0.0 4Summary: Python interface to Stan, a package for Bayesian inference 5Home-page: https://github.com/stan-dev/pystan 6Author: PyStan Developers 7Author-email: stan-users@googlegroups.com 8License: GPLv3 9Description: PyStan: The Python Interface to Stan 10 ==================================== 11 12 .. image:: https://raw.githubusercontent.com/stan-dev/logos/master/logo.png 13 :alt: Stan logo 14 :scale: 50 % 15 16 |pypi| |travis| |appveyor| |zenodo| 17 18 **PyStan** provides a Python interface to Stan, a package for Bayesian inference 19 using the No-U-Turn sampler, a variant of Hamiltonian Monte Carlo. 20 21 For more information on `Stan <http://mc-stan.org>`_ and its modeling language, 22 see the Stan User's Guide and Reference Manual at `http://mc-stan.org/ 23 <http://mc-stan.org/>`_. 24 25 Important links 26 --------------- 27 28 - HTML documentation: https://pystan.readthedocs.org 29 - Issue tracker: https://github.com/stan-dev/pystan/issues 30 - Source code repository: https://github.com/stan-dev/pystan 31 - Stan: http://mc-stan.org/ 32 - Stan User's Guide and Reference Manual (pdf) available at http://mc-stan.org 33 34 Related projects 35 ---------------- 36 37 - Scikit-learn integration: `pystan-sklearn <https://github.com/rgerkin/pystan-sklearn>`_ by @rgerkin. 38 39 Similar projects 40 ---------------- 41 42 - PyMC: http://pymc-devs.github.io/pymc/ 43 44 Detailed Installation Instructions 45 ---------------------------------- 46 Detailed installation instructions can be found in the 47 `doc/installation_beginner.md <https://github.com/chendaniely/pystan/blob/develop/doc/installation_beginner.rst/>`_ file. 48 49 Quick Installation (Linux and macOS) 50 ------------------------------------ 51 52 `NumPy <http://www.numpy.org/>`_ and `Cython <http://www.cython.org/>`_ 53 (version 0.22 or greater) are required. `matplotlib <http://matplotlib.org/>`_ 54 is optional. 55 56 PyStan and the required packages may be installed from the `Python Package Index 57 <https://pypi.python.org/pypi>`_ using ``pip``. 58 59 :: 60 61 pip install pystan 62 63 Alternatively, if Cython (version 0.22 or greater) and NumPy are already 64 available, PyStan may be installed from source with the following commands 65 66 :: 67 68 git clone --recursive https://github.com/stan-dev/pystan.git 69 cd pystan 70 python setup.py install 71 72 If you encounter an ``ImportError`` after compiling from source, try changing 73 out of the source directory before attempting ``import pystan``. On Linux and 74 OS X ``cd /tmp`` will work. 75 76 Example 77 ------- 78 79 :: 80 81 import pystan 82 import numpy as np 83 import matplotlib.pyplot as plt 84 85 schools_code = """ 86 data { 87 int<lower=0> J; // number of schools 88 real y[J]; // estimated treatment effects 89 real<lower=0> sigma[J]; // s.e. of effect estimates 90 } 91 parameters { 92 real mu; 93 real<lower=0> tau; 94 real eta[J]; 95 } 96 transformed parameters { 97 real theta[J]; 98 for (j in 1:J) 99 theta[j] = mu + tau * eta[j]; 100 } 101 model { 102 eta ~ normal(0, 1); 103 y ~ normal(theta, sigma); 104 } 105 """ 106 107 schools_dat = {'J': 8, 108 'y': [28, 8, -3, 7, -1, 1, 18, 12], 109 'sigma': [15, 10, 16, 11, 9, 11, 10, 18]} 110 111 sm = pystan.StanModel(model_code=schools_code) 112 fit = sm.sampling(data=schools_dat, iter=1000, chains=4) 113 114 print(fit) 115 116 eta = fit.extract(permuted=True)['eta'] 117 np.mean(eta, axis=0) 118 119 # if matplotlib is installed (optional, not required), a visual summary and 120 # traceplot are available 121 fit.plot() 122 plt.show() 123 124 .. |pypi| image:: https://badge.fury.io/py/pystan.png 125 :target: https://badge.fury.io/py/pystan 126 :alt: pypi version 127 128 .. |travis| image:: https://travis-ci.org/stan-dev/pystan.png?branch=master 129 :target: https://travis-ci.org/stan-dev/pystan 130 :alt: travis-ci build status 131 132 .. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/stan-dev/pystan?branch=master 133 :target: https://ci.appveyor.com/project/ariddell/pystan/branch/master 134 :alt: appveyor-ci build status 135 .. |zenodo| image:: https://zenodo.org/badge/10256919.svg 136 :target: https://zenodo.org/badge/latestdoi/10256919 137 :alt: zenodo citation DOI 138 139Platform: any 140Classifier: Programming Language :: Python 141Classifier: Programming Language :: Python :: 2 142Classifier: Programming Language :: Python :: 3 143Classifier: Programming Language :: Cython 144Classifier: Development Status :: 4 - Beta 145Classifier: Environment :: Console 146Classifier: Operating System :: OS Independent 147Classifier: Intended Audience :: Developers 148Classifier: Intended Audience :: Science/Research 149Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3) 150Classifier: Topic :: Scientific/Engineering 151Classifier: Topic :: Scientific/Engineering :: Information Analysis 152