Metadata-Version: 2.5
Name: bnn-pytorch
Version: 1.0.0
Summary: PyTorch Bayesian Neural Networks
Author-email: Philipp Oberdiek <git@oberdiek.net>
License: The MIT License (MIT)
        
        Copyright (c) 2022 Philipp Oberdiek
        
        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.
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: torch
Description-Content-Type: text/markdown

<div align="center">

[![](https://img.shields.io/badge/code%20style-ruff-d7ff64)](https://docs.astral.sh/ruff/) ![](https://img.shields.io/github/license/RonMcKay/bnn?label=license)

</div>

An implementation of bayesian neural networks which I use for research purposes.

# Installation

```
pip install bnn-pytorch
```

`bnn-pytorch` requires Python 3.11 or newer and is imported as `bnn`.

The following repositories were partly a basis for this package:

[Javier Antoran - Bayesian Neural Networks](https://github.com/JavierAntoran/Bayesian-Neural-Networks)  
[Kumar Shridhar - PyTorch Bayesian CNN](https://github.com/kumar-shridhar/PyTorch-BayesianCNN)

# Development

If you want to work on this repository, clone it (or your fork)

```
git clone https://github.com/RonMcKay/bnn.git
```

and install it using [uv](https://docs.astral.sh/uv/)

```
uv sync
```

Run the checks locally with:

```
make test
```

This runs Ruff formatting/linting and the unit tests with a minimum 95% coverage requirement for the reusable `bnn` package. The `bnn/examples` modules are reviewed and smoke-tested separately, but are excluded from that coverage threshold.

Check the fully Bayesian example against the current public APIs without running its full training loop with:

```
make example-smoke
```

Please make all your pull requests against `main`.
