{"id":20676924,"url":"https://github.com/pyro-ppl/brmp","last_synced_at":"2025-04-22T17:45:07.174Z","repository":{"id":41368166,"uuid":"210907647","full_name":"pyro-ppl/brmp","owner":"pyro-ppl","description":"Bayesian Regression Models in Pyro","archived":false,"fork":false,"pushed_at":"2024-07-25T10:57:45.000Z","size":1274,"stargazers_count":71,"open_issues_count":31,"forks_count":8,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-29T17:22:53.583Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyro-ppl.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2019-09-25T17:56:31.000Z","updated_at":"2025-02-19T09:00:44.000Z","dependencies_parsed_at":"2025-01-16T14:15:52.780Z","dependency_job_id":"3ddfb774-4548-4310-9c93-d02a13b05ac4","html_url":"https://github.com/pyro-ppl/brmp","commit_stats":{"total_commits":422,"total_committers":3,"mean_commits":"140.66666666666666","dds":"0.033175355450236976","last_synced_commit":"2acaf424598b9fdb8698f111e827b183d52f9ac3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyro-ppl%2Fbrmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyro-ppl%2Fbrmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyro-ppl%2Fbrmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyro-ppl%2Fbrmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyro-ppl","download_url":"https://codeload.github.com/pyro-ppl/brmp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250289676,"owners_count":21406030,"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-11-16T21:14:00.822Z","updated_at":"2025-04-22T17:45:07.156Z","avatar_url":"https://github.com/pyro-ppl.png","language":"Jupyter Notebook","readme":"# Bayesian Regression Models\n\nThis is an attempt to implement\na [brms](https://github.com/paul-buerkner/brms)-like library in\nPython.\n\nIt allows Bayesian regression models to be specified using (a subset\nof) the lme4 syntax. Given such a description and a pandas data frame,\nthe library generates model code and design matrices, targeting\neither [Pyro](https://pyro.ai/)\nor [NumPyro](https://github.com/pyro-ppl/numpyro).\n\n## Resources\n\n* [API documentation](https://brmp.readthedocs.io/en/latest/).\n* [Examples](https://nbviewer.jupyter.org/github/pyro-ppl/brmp/tree/master/brmp/examples/).\n  Notebooks showing the library been used to fit models to data.\n\n## Current Status\n\n### Model Specification\n\n#### Formula\n\nHere are some example formulae that the system can handle:\n\n| Formula                                      | Description |\n|----|----|\n| `y ~ x`                                      | Population-level effects |\n| `y ~ 1 + x`                                  ||\n| `y ~ x1:x2`                                  | Interaction between variables |\n| `y ~ 1 + x0 + (x1 \\| z)`                     | Group-level effects |\n| `y ~ 1 + x0 + (1 + x1 \\| z)`                 ||\n| `y ~ 1 + x0 + (1 + x1 \\|\\| z)`               | No correlation between group coefficients |\n| `y ~ 1 + x0 + (1 + x1 \\| z1:z2)`             | Grouping by multiple factors (untested) |\n| `y ~ 1 + x0 + (x1 \\| z0) + (1 + x2 \\|\\| z1)` | Combinations of the above |\n\n\n#### Priors\n\nCustom priors can be specified at various levels of granularity. For\nexample, users can specify:\n\n* A prior to be used for every population-level coefficient.\n* A prior to be used for a particular population-level coefficient.\n  (The system is aware of the coding used for categorical\n  columns/factors in the data frame, which allows priors to be\n  assigned to the coefficient corresponding to a particular level of a\n  factor.)\n* A prior to be used for all columns of the standard deviation\n  vector in every group.\n* A prior to be used for all columns of the standard deviation\n  vector in a particular group.\n* A prior to be used for a particular coefficient of the standard\n  deviation vector in a particular group.\n* etc.\n\nUsers can give multiple such specifications and they combine in a\nsensible way.\n\n#### Response Families\n\nThe library supports models with either (uni-variate) Gaussian or\nBinomial (inc. Bernoulli) distributed responses.\n\n### Inference\n\nThe Pyro back end supports both NUTS and SVI for inference. The\nNumPyro backend supports only NUTS.\n\nThe library includes the following functions for working with\nposteriors:\n\n* `marginals(...)`: This produces a model summary similar to that\n  obtained by doing `fit \u003c- brm(...) ; fit$fit` in brms.\n* `fitted(...)`: This implements some of the functionality available\n  in brms through\n  the [`fitted`](https://rdrr.io/cran/brms/man/fitted.brmsfit.html)\n  and [`predict`](https://rdrr.io/cran/brms/man/predict.brmsfit.html)\n  methods.\n\n## Limitations\n\n* All formula terms must be column names. Expressions such as\n  `sin(x1)` or `I(x1*x2)` are not supported.\n* The `*` operator is not supported. (Though the model `y ~ 1 + x1*x2`\n  can be specified with the formula `y ~ 1 + x1 + x2 + x1:x2`.)\n* The `/` operator is not supported. (Though the model `y ~ ... |\n  g1/g2` can be specified with the formula `y ~ (... | g1) + (... |\n  g1:g2)`.)\n* The syntax for removing columns is not supported. e.g. `y ~ x - 1`\n* The response is always uni-variate.\n* Parameters of the response distribution cannot take their values\n  from the data. e.g. The number of trials parameter of Binomial can\n  only be set to a constant, and cannot vary across rows of the data.\n* Only a limited number of response families are supported. In\n  particular, Categorical responses (beyond the binary case) are not\n  supported.\n* Some priors used in the generated code don't match those generated\n  by brms. e.g. There's no Half Student-t distribution, setting prior\n  parameters based on the data isn't supported.\n* The centering data transform, performed by brms to improve sampling\n  efficiency, is not implemented.\n* This doesn't include any of the fancy stuff brms does, such as its\n  extensions to the lme4 grouping syntax, splines, monotonic effects,\n  GP terms, etc.\n* The `fitted` function does not implement all of the functionality of\n  its analogue in brms.\n* There are no tools to help with MCMC diagnostics, posterior checks,\n  hypothesis testing, etc.\n* Lots more, probably...\n","funding_links":[],"categories":["Software"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyro-ppl%2Fbrmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyro-ppl%2Fbrmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyro-ppl%2Fbrmp/lists"}