numpyro-oop


Namenumpyro-oop JSON
Version 0.0.2 PyPI version JSON
download
home_pageNone
SummaryA convenient object-oriented wrapper for working with numpyro models.
upload_time2024-09-25 19:40:34
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseCopyright (c) 2024 Thomas Wallis Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords numpyro probabilistic programming mcmc bayesian inference
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # An object-oriented interface to numpyro

[![CI](https://github.com/ag-perception-wallis-lab/numpyro-oop/actions/workflows/pytest.yml/badge.svg)](https://github.com/ag-perception-wallis-lab/numpyro-oop/actions/workflows/pytest.yml)
[![PyPI version](https://badge.fury.io/py/numpyro-oop.svg)](https://badge.fury.io/py/numpyro-oop)

This package provides a wrapper for working with [numpyro](https://num.pyro.ai/) models.
It aims to remain model-agnostic, but package up a lot of the model fitting code to reduce repetition.

It is intended to make life a bit easier for people who are already familiar with Numpyro and Bayesian modelling.
It is not intended to fulfil the same high-level wrapper role as packages such as [brms](https://paul-buerkner.github.io/brms/).
The user is still required to write the model.

## Getting started

```
pip install numpyro-oop
```

The basic idea is that the user defines a new class that inherits from `BaseNumpyroModel`, 
and defines (minimally) the model to be fit by overwriting the `model` method:

```python
from numpyro_oop import BaseNumpyroModel

class DemoModel(BaseNumpyroModel):
    def model(self, data=None):
        ...

m1 = DemoModel(data=df, seed=42)
```

Then all other sampling and prediction steps are handled by `numpyro-oop`, or related libraries (e.g. `arviz`):

```python
m1.sample()  # sample from the model
preds = m1.predict()  # generate model predictions for the dataset given at initialization, or pass a new dataset
m1.generate_arviz_data()  # generate an Arviz InferenceData object stored in self.arviz_data
```

A more complete demo can be found in `/scripts/demo_1.ipynb`.

### Roadmap after initial release

- [ ] include doctest, improved examples
- [ ] demo and tests for multiple group variables
- [ ] export docs to some static page (readthedocs or similar); detail info on class methods and attributes
- [ ] Contributor guidelines
- [ ] Fix type hints via linter checks


### Development notes

- Update dependencies with `make update-deps`
- Update and (re)install the environment with `make update-and-install`




            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "numpyro-oop",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "numpyro, probabilistic programming, mcmc, bayesian inference",
    "author": null,
    "author_email": "Thomas Wallis <thomas.wallis@tu-darmstadt.de>",
    "download_url": "https://files.pythonhosted.org/packages/54/6a/5c39029f667abe1d7e83300ea4fbc6fc3a45dfe7d4d8169e06ad2ca48507/numpyro_oop-0.0.2.tar.gz",
    "platform": null,
    "description": "# An object-oriented interface to numpyro\n\n[![CI](https://github.com/ag-perception-wallis-lab/numpyro-oop/actions/workflows/pytest.yml/badge.svg)](https://github.com/ag-perception-wallis-lab/numpyro-oop/actions/workflows/pytest.yml)\n[![PyPI version](https://badge.fury.io/py/numpyro-oop.svg)](https://badge.fury.io/py/numpyro-oop)\n\nThis package provides a wrapper for working with [numpyro](https://num.pyro.ai/) models.\nIt aims to remain model-agnostic, but package up a lot of the model fitting code to reduce repetition.\n\nIt is intended to make life a bit easier for people who are already familiar with Numpyro and Bayesian modelling.\nIt is not intended to fulfil the same high-level wrapper role as packages such as [brms](https://paul-buerkner.github.io/brms/).\nThe user is still required to write the model.\n\n## Getting started\n\n```\npip install numpyro-oop\n```\n\nThe basic idea is that the user defines a new class that inherits from `BaseNumpyroModel`, \nand defines (minimally) the model to be fit by overwriting the `model` method:\n\n```python\nfrom numpyro_oop import BaseNumpyroModel\n\nclass DemoModel(BaseNumpyroModel):\n    def model(self, data=None):\n        ...\n\nm1 = DemoModel(data=df, seed=42)\n```\n\nThen all other sampling and prediction steps are handled by `numpyro-oop`, or related libraries (e.g. `arviz`):\n\n```python\nm1.sample()  # sample from the model\npreds = m1.predict()  # generate model predictions for the dataset given at initialization, or pass a new dataset\nm1.generate_arviz_data()  # generate an Arviz InferenceData object stored in self.arviz_data\n```\n\nA more complete demo can be found in `/scripts/demo_1.ipynb`.\n\n### Roadmap after initial release\n\n- [ ] include doctest, improved examples\n- [ ] demo and tests for multiple group variables\n- [ ] export docs to some static page (readthedocs or similar); detail info on class methods and attributes\n- [ ] Contributor guidelines\n- [ ] Fix type hints via linter checks\n\n\n### Development notes\n\n- Update dependencies with `make update-deps`\n- Update and (re)install the environment with `make update-and-install`\n\n\n\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2024 Thomas Wallis  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A convenient object-oriented wrapper for working with numpyro models.",
    "version": "0.0.2",
    "project_urls": null,
    "split_keywords": [
        "numpyro",
        " probabilistic programming",
        " mcmc",
        " bayesian inference"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aa925ad9c90bd8b006f420aad9f5f2ef176c899ba279091383ce43b19062a796",
                "md5": "8bc9cdfc115e72e281a9e6095e1716ad",
                "sha256": "2f350a524da9f71f61d899c2d223c42c348c42b28e65344a96b5c0ea9791c126"
            },
            "downloads": -1,
            "filename": "numpyro_oop-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8bc9cdfc115e72e281a9e6095e1716ad",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10262,
            "upload_time": "2024-09-25T19:40:32",
            "upload_time_iso_8601": "2024-09-25T19:40:32.482093Z",
            "url": "https://files.pythonhosted.org/packages/aa/92/5ad9c90bd8b006f420aad9f5f2ef176c899ba279091383ce43b19062a796/numpyro_oop-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "546a5c39029f667abe1d7e83300ea4fbc6fc3a45dfe7d4d8169e06ad2ca48507",
                "md5": "0cbe28a917251147442111a74d9ca004",
                "sha256": "a4d256f198974dbc6863118e31bd9ca85a252ef8d7d51cee5f40784e12cc36b0"
            },
            "downloads": -1,
            "filename": "numpyro_oop-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "0cbe28a917251147442111a74d9ca004",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 16465,
            "upload_time": "2024-09-25T19:40:34",
            "upload_time_iso_8601": "2024-09-25T19:40:34.323971Z",
            "url": "https://files.pythonhosted.org/packages/54/6a/5c39029f667abe1d7e83300ea4fbc6fc3a45dfe7d4d8169e06ad2ca48507/numpyro_oop-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-25 19:40:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "numpyro-oop"
}
        
Elapsed time: 3.42372s