{{ message }}

# nicola-decao / power_spherical

Pytorch implementation of the Power Spherical distribution

## Files

Failed to load latest commit information.
Type
Name
Commit time
Jun 5, 2020
Oct 8, 2020
Jun 5, 2020
Jun 5, 2020

# The Power Spherical distribution

## Overview

This library contains a Pytorch implementation of the Power Spherical distribution, as presented in [1](https://arxiv.org/abs/2006.04437).

## Dependencies

Notice that older version could work but they were not tested.

Optional dependency for examples needed for plotting and numerical checks (again older version could work but they were not tested):

## Installation

To install, run

\$ python setup.py install

## Structure

• distributions: Pytorch implementation of the Power Spherical and hyperspherical Uniform distributions. Both inherit from torch.distributions.Distribution.
• examples: Example code for using the library within a PyTorch project.

## Usage

Please have a look into the examples. We adapted our implementation to follow the structure of the Pytorch probability distributions.

Here a minimal example that demonstrate differentiable sampling:

>>> from power_spherical import PowerSpherical
>>> p = PowerSpherical(
)
>>> p.rsample()

and computing KL divergence with the uniform distribution:

>>> from power_spherical import HypersphericalUniform
>>> q = HypersphericalUniform(dim=2)
>>> torch.distributions.kl_divergence(p, q)

Examples of 2D and 3D plots are show in examples and will generate something similar to these figures below.

## Feedback

For questions and comments, feel free to contact Nicola De Cao.

MIT

## Citation

[1] De Cao, N., Aziz, W. (2020).
The Power Spherical distrbution.
In Proceedings of the 37th International
Conference on Machine Learning, INNF+.

BibTeX format:

@article{decao2020power,
title={The Power Spherical distrbution},
author={
De Cao, Nicola and
Aziz, Wilker},
journal={Proceedings of the 37th International Conference on Machine Learning, INNF+},
year={2020}
}

Pytorch implementation of the Power Spherical distribution