pystan
Advanced tools
+3
-3
| Metadata-Version: 2.1 | ||
| Name: pystan | ||
| Version: 3.4.0 | ||
| Version: 3.5.0 | ||
| Summary: Python interface to Stan, a package for Bayesian inference | ||
@@ -19,3 +19,3 @@ Home-page: https://mc-stan.org | ||
| Requires-Dist: clikit (>=0.6,<0.7) | ||
| Requires-Dist: httpstan (>=4.7,<4.8) | ||
| Requires-Dist: httpstan (>=4.8,<4.9) | ||
| Requires-Dist: numpy (>=1.19,<2.0) | ||
@@ -49,3 +49,3 @@ Requires-Dist: pysimdjson (>=3.2,<4.0) | ||
| Install PyStan with ``pip install pystan``. PyStan requires Python ≥3.7 running on Linux or macOS. You will also need a C++ compiler such as gcc ≥9.0 or clang ≥10.0. | ||
| 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. | ||
@@ -52,0 +52,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. |
+9
-10
| [tool.poetry] | ||
| name = "pystan" | ||
| version = "3.4.0" | ||
| version = "3.5.0" | ||
| description = "Python interface to Stan, a package for Bayesian inference" | ||
@@ -27,3 +27,3 @@ authors = [ | ||
| aiohttp = "^3.6" | ||
| httpstan = "~4.7" | ||
| httpstan = "~4.8" | ||
| pysimdjson = "^3.2" | ||
@@ -35,15 +35,14 @@ numpy = "^1.19" | ||
| [tool.poetry.dev-dependencies] | ||
| pytest = "^5.4" | ||
| pytest-cov = "^2.8" | ||
| pytest-asyncio = "^0.10" | ||
| pytest = "^6.2" | ||
| pytest-asyncio = "^0.18.3" | ||
| pandas = "^1.0" | ||
| autoflake = "^1.4" | ||
| black = "22.1.0" | ||
| black = "22.6.0" | ||
| isort = "^5.9" | ||
| mypy = "0.910" | ||
| mypy = "0.961" | ||
| types-setuptools = "^57.4" | ||
| flake8 = "^3.9" | ||
| flake8 = "^4.0" | ||
| # documentation | ||
| sphinx = "^3.5" | ||
| sphinx-rtd-theme = "^0.5" | ||
| sphinx = "^5.0" | ||
| sphinx-rtd-theme = "^1.0" | ||
@@ -50,0 +49,0 @@ [tool.black] |
+1
-1
@@ -22,3 +22,3 @@ ****** | ||
| Install PyStan with ``pip install pystan``. PyStan requires Python ≥3.7 running on Linux or macOS. You will also need a C++ compiler such as gcc ≥9.0 or clang ≥10.0. | ||
| 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. | ||
@@ -25,0 +25,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. |
+3
-3
@@ -13,3 +13,3 @@ # -*- coding: utf-8 -*- | ||
| 'clikit>=0.6,<0.7', | ||
| 'httpstan>=4.7,<4.8', | ||
| 'httpstan>=4.8,<4.9', | ||
| 'numpy>=1.19,<2.0', | ||
@@ -21,5 +21,5 @@ 'pysimdjson>=3.2,<4.0', | ||
| 'name': 'pystan', | ||
| 'version': '3.4.0', | ||
| 'version': '3.5.0', | ||
| 'description': 'Python interface to Stan, a package for Bayesian inference', | ||
| 'long_description': '******\nPyStan\n******\n\n**PyStan** is a Python interface to Stan, a package for Bayesian inference.\n\nStan® is a state-of-the-art platform for statistical modeling and\nhigh-performance statistical computation. Thousands of users rely on Stan for\nstatistical modeling, data analysis, and prediction in the social, biological,\nand physical sciences, engineering, and business.\n\nNotable features of PyStan include:\n\n* Automatic caching of compiled Stan models\n* Automatic caching of samples from Stan models\n* An interface similar to that of RStan\n* Open source software: ISC License\n\nGetting started\n===============\n\nInstall PyStan with ``pip install pystan``. PyStan requires Python ≥3.7 running on Linux or macOS. You will also need a C++ compiler such as gcc ≥9.0 or clang ≥10.0.\n\nThe 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.\n\n.. code-block:: python\n\n import stan\n\n schools_code = """\n data {\n int<lower=0> J; // number of schools\n real y[J]; // estimated treatment effects\n real<lower=0> sigma[J]; // standard error of effect estimates\n }\n parameters {\n real mu; // population treatment effect\n real<lower=0> tau; // standard deviation in treatment effects\n vector[J] eta; // unscaled deviation from mu by school\n }\n transformed parameters {\n vector[J] theta = mu + tau * eta; // school treatment effects\n }\n model {\n target += normal_lpdf(eta | 0, 1); // prior log-density\n target += normal_lpdf(y | theta, sigma); // log-likelihood\n }\n """\n\n schools_data = {"J": 8,\n "y": [28, 8, -3, 7, -1, 1, 18, 12],\n "sigma": [15, 10, 16, 11, 9, 11, 10, 18]}\n\n posterior = stan.build(schools_code, data=schools_data)\n fit = posterior.sample(num_chains=4, num_samples=1000)\n eta = fit["eta"] # array with shape (8, 4000)\n df = fit.to_frame() # pandas `DataFrame`\n\n\nCitation\n========\n\nWe appreciate citations as they let us discover what people have been doing\nwith the software. Citations also provide evidence of use which can help in\nobtaining grant funding.\n\nTo cite PyStan in publications use:\n\nRiddell, A., Hartikainen, A., & Carter, M. (2021). PyStan (3.0.0). https://pypi.org/project/pystan\n\nOr use the following BibTeX entry::\n\n @misc{pystan,\n title = {pystan (3.0.0)},\n author = {Riddell, Allen and Hartikainen, Ari and Carter, Matthew},\n year = {2021},\n month = mar,\n howpublished = {PyPI}\n }\n\nPlease also cite Stan.\n', | ||
| 'long_description': '******\nPyStan\n******\n\n**PyStan** is a Python interface to Stan, a package for Bayesian inference.\n\nStan® is a state-of-the-art platform for statistical modeling and\nhigh-performance statistical computation. Thousands of users rely on Stan for\nstatistical modeling, data analysis, and prediction in the social, biological,\nand physical sciences, engineering, and business.\n\nNotable features of PyStan include:\n\n* Automatic caching of compiled Stan models\n* Automatic caching of samples from Stan models\n* An interface similar to that of RStan\n* Open source software: ISC License\n\nGetting started\n===============\n\nInstall 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.\n\nThe 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.\n\n.. code-block:: python\n\n import stan\n\n schools_code = """\n data {\n int<lower=0> J; // number of schools\n real y[J]; // estimated treatment effects\n real<lower=0> sigma[J]; // standard error of effect estimates\n }\n parameters {\n real mu; // population treatment effect\n real<lower=0> tau; // standard deviation in treatment effects\n vector[J] eta; // unscaled deviation from mu by school\n }\n transformed parameters {\n vector[J] theta = mu + tau * eta; // school treatment effects\n }\n model {\n target += normal_lpdf(eta | 0, 1); // prior log-density\n target += normal_lpdf(y | theta, sigma); // log-likelihood\n }\n """\n\n schools_data = {"J": 8,\n "y": [28, 8, -3, 7, -1, 1, 18, 12],\n "sigma": [15, 10, 16, 11, 9, 11, 10, 18]}\n\n posterior = stan.build(schools_code, data=schools_data)\n fit = posterior.sample(num_chains=4, num_samples=1000)\n eta = fit["eta"] # array with shape (8, 4000)\n df = fit.to_frame() # pandas `DataFrame`\n\n\nCitation\n========\n\nWe appreciate citations as they let us discover what people have been doing\nwith the software. Citations also provide evidence of use which can help in\nobtaining grant funding.\n\nTo cite PyStan in publications use:\n\nRiddell, A., Hartikainen, A., & Carter, M. (2021). PyStan (3.0.0). https://pypi.org/project/pystan\n\nOr use the following BibTeX entry::\n\n @misc{pystan,\n title = {pystan (3.0.0)},\n author = {Riddell, Allen and Hartikainen, Ari and Carter, Matthew},\n year = {2021},\n month = mar,\n howpublished = {PyPI}\n }\n\nPlease also cite Stan.\n', | ||
| 'author': 'Allen Riddell', | ||
@@ -26,0 +26,0 @@ 'author_email': 'riddella@indiana.edu', |
+2
-1
@@ -24,3 +24,4 @@ """Common routines""" | ||
| def json(self) -> dict: | ||
| return simdjson.loads(self.content) | ||
| # mypy 0.961 complains that simdjson lacks a `loads`. | ||
| return simdjson.loads(self.content) # type: ignore | ||
@@ -27,0 +28,0 @@ |
+1
-1
@@ -68,3 +68,3 @@ import collections | ||
| try: | ||
| msg = parser.parse(line) | ||
| msg = cast(simdjson.Object, parser.parse(line)) | ||
| except ValueError: | ||
@@ -71,0 +71,0 @@ # Occurs when draws contain an nan or infinity. simdjson cannot parse such values. |
+4
-3
@@ -6,3 +6,3 @@ import asyncio | ||
| import time | ||
| from typing import Dict, List, Optional, Sequence, Tuple, Union | ||
| from typing import Dict, List, Optional, Sequence, Tuple, Union, cast | ||
@@ -262,7 +262,8 @@ import httpstan.models | ||
| def is_nonempty_logger_message(msg: simdjson.Object): | ||
| return msg["topic"] == "logger" and msg["values"][0] != "info:" | ||
| return msg["topic"] == "logger" and msg["values"][0] != "info:" # type: ignore | ||
| def is_iteration_or_elapsed_time_logger_message(msg: simdjson.Object): | ||
| # Assumes `msg` is a message with topic `logger`. | ||
| text = msg["values"][0] | ||
| text = msg["values"][0] # type: ignore | ||
| text = cast(str, text) | ||
| return ( | ||
@@ -269,0 +270,0 @@ text.startswith("info:Iteration:") |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
48003
0.18%715
0.28%