This is a Bayesian Neural Network (BNN) implementation for
PyTorch. The implementation follows Yarin Gal's papers
"Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep
Learning" (see BDropout
) and "Concrete Dropout" (see CDropout
).
This package was originally based off the work here: juancamilog/prob_mbrl.
To install simply clone and run:
python setup.py install
You may also install the dependencies with pipenv as follows:
pipenv install
Finally, you may add this to your own application with either:
pip install 'git+https://github.com/anassinator/bnn.git#egg=bnn'
pipenv install 'git+https://github.com/anassinator/bnn.git#egg=bnn'
After installation, import
and use as follows:
import bnn
You can see the examples directory for some Jupyter notebooks with more detailed examples.
The following is an example of what this BNN was able to estimate
with a few randomly sampled points (in red) of a noisy sin
function.
The dotted curve represent the real function that was kept a secret from the
model, whereas the black line and the grey area represent the
estimated mean and uncertainty.
Contributions are welcome. Simply open an issue or pull request on the matter.
We use YAPF for all Python formatting needs. You can auto-format your changes with the following command:
yapf --recursive --in-place --parallel .
You can install the formatter with:
pipenv install --dev
See LICENSE.