{"id":13656012,"url":"https://github.com/stan-dev/pystan","last_synced_at":"2025-05-15T11:08:51.472Z","repository":{"id":38337206,"uuid":"103834038","full_name":"stan-dev/pystan","owner":"stan-dev","description":"PyStan, a Python interface to Stan, a platform for statistical modeling. Documentation: https://pystan.readthedocs.io","archived":false,"fork":false,"pushed_at":"2024-07-03T17:03:56.000Z","size":224,"stargazers_count":352,"open_issues_count":13,"forks_count":60,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-05-08T10:26:20.411Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"stan-dev","custom":"https://mc-stan.org/support/"}},"created_at":"2017-09-17T14:13:04.000Z","updated_at":"2025-04-27T10:23:50.000Z","dependencies_parsed_at":"2023-01-21T22:46:47.920Z","dependency_job_id":"f8a375d9-978d-418c-b38f-449ddc480287","html_url":"https://github.com/stan-dev/pystan","commit_stats":{"total_commits":237,"total_committers":16,"mean_commits":14.8125,"dds":"0.11392405063291144","last_synced_commit":"cdd7b5f5296e01be0c9af7a8457ffc3c2ce6175b"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stan-dev%2Fpystan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stan-dev%2Fpystan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stan-dev%2Fpystan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stan-dev%2Fpystan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stan-dev","download_url":"https://codeload.github.com/stan-dev/pystan/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253815239,"owners_count":21968593,"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":[],"created_at":"2024-08-02T04:00:45.849Z","updated_at":"2025-05-15T11:08:51.452Z","avatar_url":"https://github.com/stan-dev.png","language":"Python","readme":"******\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\u003clower=0\u003e J;         // number of schools\n      array[J] real y;              // estimated treatment effects\n      array[J] real\u003clower=0\u003e sigma; // standard error of effect estimates\n    }\n    parameters {\n      real mu;                // population treatment effect\n      real\u003clower=0\u003e 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., \u0026 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","funding_links":["https://github.com/sponsors/stan-dev","https://mc-stan.org/support/"],"categories":["Probabilistic Methods","其他_机器学习与深度学习","概率统计","Uncategorized","🎲 Statistics \u0026 Probability"],"sub_categories":["Others","NLP","Uncategorized","Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstan-dev%2Fpystan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstan-dev%2Fpystan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstan-dev%2Fpystan/lists"}