Skip to content

Commit 67158c9

Browse files
Update README.md
1 parent 84761d5 commit 67158c9

File tree

1 file changed

+41
-37
lines changed

1 file changed

+41
-37
lines changed

README.md

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,55 @@
1-
# Bayesian-Torch: Bayesian neural network layers for uncertainty estimation
2-
**[Get started](https://github.com/IntelLabs/bayesian-torch#installation)** | **[Example usage](https://github.com/IntelLabs/bayesian-torch#usage)** | **[Documentation](https://github.com/IntelLabs/bayesian-torch/blob/main/doc/bayesian_torch.layers.md)** | **[License](https://github.com/IntelLabs/bayesian-torch/blob/main/LICENSE)** | **[Citing](https://github.com/IntelLabs/bayesian-torch#citing)**
1+
<div align="center">
32

4-
### Bayesian layers and utilities to perform stochastic variational inference in PyTorch
3+
<img src="assets/bayesian-torch.png" width="500px">
4+
<h2 >
5+
A library for Bayesian neural network layers and uncertainty estimation in Deep Learning </a>
6+
</h2>
57

6-
Bayesian-Torch is a library of neural network layers and utilities extending the core of PyTorch to enable the user to perform stochastic variational inference in Bayesian deep neural networks.
7-
Bayesian-Torch is designed to be flexible and seamless in extending a deterministic deep neural network architecture to corresponding Bayesian form by simply replacing the deterministic layers with Bayesian layers.
8+
[![python](https://img.shields.io/badge/python-3.7%2B-blue)]()
9+
[![pytorch](https://img.shields.io/badge/pytorch-1.7.0%2B-orange)]()
10+
[![version](https://img.shields.io/badge/release-0.2.0-green)]()
11+
[![license](https://img.shields.io/badge/license-BSD%203--Clause-darkblue)](https://github.com/IntelLabs/bayesian-torch/blob/main/LICENSE)
12+
<h4 align="center">
13+
<a href="https://github.com/IntelLabs/bayesian-torch#installation">Get Started</a> |
14+
<a href="https://github.com/IntelLabs/bayesian-torch#usage">Example usage</a> |
15+
<a href="https://github.com/IntelLabs/bayesian-torch/blob/main/doc/bayesian_torch.layers.md">Documentation</a> |
16+
<a href="https://github.com/IntelLabs/bayesian-torch#citing">Citing</a>
17+
</h4>
818

19+
</div>
920

10-
The repository has implementations for the following Bayesian layers:
11-
- [x] **[Variational layers with reparameterized Monte Carlo estimators](https://github.com/IntelLabs/bayesian-torch/tree/main/bayesian_torch/layers/variational_layers)** [[Blundell et al. 2015](https://arxiv.org/abs/1505.05424)]
21+
___
22+
23+
Bayesian-Torch is a library of neural network layers and utilities extending the core of PyTorch to enable Bayesian inference in deep learning models to quantify principled uncertainty estimates in model predictions.
24+
25+
## Overview
26+
Bayesian-Torch is designed to be flexible and enables seamless extension of deterministic deep neural network model to corresponding Bayesian form by simply replacing the deterministic layers with Bayesian layers. It enables user to perform stochastic variational inference in deep neural networks.
27+
28+
**Bayesian layers:**
29+
30+
* **[Variational layers with reparameterized Monte Carlo estimators](https://github.com/IntelLabs/bayesian-torch/tree/main/bayesian_torch/layers/variational_layers)** [[Blundell et al. 2015](https://arxiv.org/abs/1505.05424)]
1231

1332
14-
LinearVariational
15-
Conv1dVariational, Conv2dVariational, Conv3dVariational, ConvTranspose1dVariational, ConvTranspose2dVariational, ConvTranspose3dVariational
16-
LSTMVariational
33+
LinearReparameterization
34+
Conv1dReparameterization, Conv2dReparameterization, Conv3dReparameterization, ConvTranspose1dReparameterization, ConvTranspose2dReparameterization, ConvTranspose3dReparameterization
35+
LSTMReparameterization
1736
18-
- [x] **[Variational layers with Flipout Monte Carlo estimators](https://github.com/IntelLabs/bayesian-torch/tree/main/bayesian_torch/layers/flipout_layers)** [[Wen et al. 2018](https://arxiv.org/abs/1803.04386)]
37+
* **[Variational layers with Flipout Monte Carlo estimators](https://github.com/IntelLabs/bayesian-torch/tree/main/bayesian_torch/layers/flipout_layers)** [[Wen et al. 2018](https://arxiv.org/abs/1803.04386)]
1938

2039
LinearFlipout
2140
Conv1dFlipout, Conv2dFlipout, Conv3dFlipout, ConvTranspose1dFlipout, ConvTranspose2dFlipout, ConvTranspose3dFlipout
2241
LSTMFlipout
2342

24-
<!--
25-
- [ ] **[Radial BNN layers](bayesian_torch/layers/radial_layers)** [[Farquhar et al. 2020](https://arxiv.org/abs/1907.00865)]
26-
27-
LinearRadial
28-
Conv1dRadial, Conv2dRadial, Conv3dRadial, ConvTranspose1dRadial, ConvTranspose2dRadial, ConvTranspose3dRadial
29-
LSTMRadial
3043

31-
- [ ] **Variational layers with Gaussian mixture model (GMM) posteriors using reparameterized Monte Carlo estimators** (in `pre-alpha`)
3244

33-
LinearMixture
34-
Conv1dMixture, Conv2dMixture, Conv3dMixture, ConvTranspose1dMixture, ConvTranspose2dMixture, ConvTranspose3dMixture
35-
LSTMMixture
36-
-->
37-
38-
<!--
39-
Please refer to [documentation](doc/bayesian_torch.layers.md#layers) of Bayesian layers for details.
40-
-->
41-
42-
Other features include:
43-
- [x] [dnn_to_bnn()](https://github.com/IntelLabs/bayesian-torch/blob/main/bayesian_torch/models/dnn_to_bnn.py#L127): An API to convert deterministic deep neural network (dnn) model of any architecture to Bayesian deep neural network (bnn) model, simplifying the model definition i.e. drop-in replacements of Convolutional, Linear and LSTM layers to corresponding Bayesian layers. This will enable seamless conversion of existing topology of larger models to Bayesian deep neural network models for extending towards uncertainty-aware applications.
44-
- [x] [MOPED](https://github.com/IntelLabs/bayesian-torch/blob/main/bayesian_torch/utils/util.py#L72): Specifying weight priors and variational posteriors in Bayesian neural networks with Empirical Bayes [[Krishnan et al. 2020](https://ojs.aaai.org/index.php/AAAI/article/view/5875)]
45-
- [x] [AvUC](https://github.com/IntelLabs/bayesian-torch/blob/main/bayesian_torch/utils/avuc_loss.py): Accuracy versus Uncertainty Calibration loss [[Krishnan and Tickoo 2020](https://proceedings.neurips.cc/paper/2020/file/d3d9446802a44259755d38e6d163e820-Paper.pdf)]
45+
**Key features:**
46+
* [dnn_to_bnn()](https://github.com/IntelLabs/bayesian-torch/blob/main/bayesian_torch/models/dnn_to_bnn.py#L127): An API to convert deterministic deep neural network (dnn) model of any architecture to Bayesian deep neural network (bnn) model, simplifying the model definition i.e. drop-in replacements of Convolutional, Linear and LSTM layers to corresponding Bayesian layers. This will enable seamless conversion of existing topology of larger models to Bayesian deep neural network models for extending towards uncertainty-aware applications.
47+
* [MOPED](https://github.com/IntelLabs/bayesian-torch/blob/main/bayesian_torch/utils/util.py#L72): Specifying weight priors and variational posteriors in Bayesian neural networks with Empirical Bayes [[Krishnan et al. 2020](https://ojs.aaai.org/index.php/AAAI/article/view/5875)]
48+
* [AvUC](https://github.com/IntelLabs/bayesian-torch/blob/main/bayesian_torch/utils/avuc_loss.py): Accuracy versus Uncertainty Calibration loss [[Krishnan and Tickoo 2020](https://proceedings.neurips.cc/paper/2020/file/d3d9446802a44259755d38e6d163e820-Paper.pdf)]
4649

47-
## Installation
50+
## Installing Bayesian-Torch
4851
<!--
49-
**To install from PyPI:**
52+
**To install core library using `pip`:**
5053
```
5154
pip install bayesian-torch
5255
```
@@ -68,10 +71,11 @@ Dependencies:
6871
- pip install tensorboard
6972
- pip install scikit-learn
7073
-->
74+
7175
## Usage
7276
There are two ways to build Bayesian deep neural networks using Bayesian-Torch:
73-
1. Convert an existing deterministic deep neural network (dnn) model to Bayesian deep neural network (bnn) model with dnn_to_bnn()
74-
2. Define your custom model using the Bayesian layers ([Flipout](https://github.com/IntelLabs/bayesian-torch/tree/main/bayesian_torch/layers/flipout_layers) or [Reparameterization](https://github.com/IntelLabs/bayesian-torch/tree/main/bayesian_torch/layers/variational_layers))
77+
1. Convert an existing deterministic deep neural network (dnn) model to Bayesian deep neural network (bnn) model with dnn_to_bnn() API
78+
2. Define your custom model using the Bayesian layers ([Reparameterization](https://github.com/IntelLabs/bayesian-torch/tree/main/bayesian_torch/layers/variational_layers) or [Flipout](https://github.com/IntelLabs/bayesian-torch/tree/main/bayesian_torch/layers/flipout_layers))
7579

7680
(1) For instance, building Bayesian-ResNet18 from torchvision deterministic ResNet18 model is as simple as:
7781
```
@@ -92,7 +96,7 @@ const_bnn_prior_parameters = {
9296
model = torchvision.models.resnet18()
9397
dnn_to_bnn(model, const_bnn_prior_parameters)
9498
```
95-
To use MOPED method, setting the prior and initializing variational parameters from a pretrained deterministic model (helps training convergence of larger models):
99+
To use MOPED method i.e. setting the prior and initializing variational parameters from a pretrained deterministic model (helps training convergence of larger models):
96100
```
97101
const_bnn_prior_parameters = {
98102
"prior_mu": 0.0,
@@ -234,7 +238,7 @@ MOdel Priors with Empirical Bayes using DNN (MOPED)
234238
}
235239
```
236240

237-
This code is intended for researchers and developers, enables to quantify principled uncertainty estimates from deep neural network predictions using stochastic variational inference in Bayesian neural networks.
241+
This library and code is intended for researchers and developers, enables to quantify principled uncertainty estimates from deep learning model predictions using stochastic variational inference in Bayesian neural networks.
238242
Feedbacks, issues and contributions are welcome. Email to <[email protected]> for any questions.
239243

240244

0 commit comments

Comments
 (0)