An open API service indexing awesome lists of open source software.

https://github.com/xmodar/network_moments

A toolkit for computing some probabilistic moments of deep neural networks.
https://github.com/xmodar/network_moments

deep-learning neural-networks probability

Last synced: about 1 year ago
JSON representation

A toolkit for computing some probabilistic moments of deep neural networks.

Awesome Lists containing this project

README

          

# Network Moments

Network Moments is a toolkit that enables computing some probabilistic moments of deep neural networks given a specific input distribution. The current implementation allows you to compute the first and second Gaussian network moments (GNM) of affine-ReLU-affine networks i.e., the output mean and variance subject to Gaussian input.

theorems

The main backend framework is [PyTorch](./network_moments/torch/) but also [TensorFlow](./network_moments/tensorflow/) and [MatLab](./matlab/) are supported.

### Requirements

Network Moments was developed and tested with the following:

- [Python](https://www.python.org/) v3.6.3+
- **Option 1**: [`PyTorch`](./network_moments/torch/)
- [torch](https://pytorch.org/) v0.4.1+
- [torchvision](https://github.com/pytorch/vision) v0.2.1+
- **Option 2**: [`TensorFlow`](./network_moments/tensorflow/)
- [numpy](http://www.numpy.org) v1.14.2+
- [tensorflow](https://www.tensorflow.org/) v1.8.0+
- **Option 3**: [`MatLab`](./matlab/)
- [matlab](https://www.mathworks.com/products/matlab.html) vR2017b+

You need [Jupyter](https://jupyter.org/) to run [tightness](./static/tightness.ipynb). It is recommended that you have [Jupyter Lab](https://github.com/jupyterlab/jupyterlab).

### Installation

After installing the requirements, to install or update this package run the following in the terminal:

```sh
pip install -U git+https://github.com/ModarTensai/network_moments.git
```

Now go to the [tightness notebook](./static/tightness.ipynb) to see how to use this tool with the default backend framework.

To uninstall the package:

```sh
pip uninstall network_moments
```

### Usage

To import the [`PyTorch`](./network_moments/torch/) sub-package:

```python
import network_moments.torch as nm
```

The basic usage is demonstrated in the [tightness notebook](./static/tightness.ipynb).

To import the [`TensorFlow`](./network_moments/tensorflow/) sub-package:

```python
import network_moments.tensorflow as nm
```
Please, refer to [tensorflow tests notebook](./static/tensorflow_tests.ipynb) for examples to compare [`PyTorch`](./network_moments/torch/) and [`TensorFlow`](./network_moments/tensorflow/) implementations.

### Cite

This is the official implementation of the method described in [this paper](http://openaccess.thecvf.com/content_cvpr_2018/html/Bibi_Analytic_Expressions_for_CVPR_2018_paper.html) (checkout the [poster](https://drive.google.com/file/d/1S_HurI9vwhhqyzAabDiaq0ZJBPBrV_xh/view)):

```bibtex
@InProceedings{Bibi_2018_CVPR,
author = {Bibi, Adel and Alfadly, Modar and Ghanem, Bernard},
title = {Analytic Expressions for Probabilistic Moments of PL-DNN With Gaussian Input},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2018}
}
```

### License

MIT

### Author

[Modar M. Alfadly](https://github.com/ModarTensai/network_moments/)

### Contributors

I would gladly accept any pull request that improves any aspect of this repository.