Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/stat-ml/hist-loss

Package with histogram-based losses
https://github.com/stat-ml/hist-loss

earth-mover-distance histogram-loss pytorch

Last synced: about 1 month ago
JSON representation

Package with histogram-based losses

Awesome Lists containing this project

README

        

[![PyPI version](https://badge.fury.io/py/hist-loss.svg)](https://badge.fury.io/py/hist-loss)
[![Build Status](https://travis-ci.com/stat-ml/hist-loss.svg?token=oPGnutpqNa9oAaMSKt7n&branch=main)](https://travis-ci.com/stat-ml/histloss)
[![PyPI license](https://img.shields.io/pypi/l/hist-loss.svg)](https://pypi.python.org/pypi/hist-loss/)

# Histogram Based Losses

This library contains implementations of some histogram-based loss functions:
- Earth Mover Distrance Loss
- Histgramm Loss ([paper](https://arxiv.org/pdf/1611.00822.pdf), [original code](https://github.com/madkn/HistogramLoss))
- Inverse Histogram Loss (our impovements)
- Bidirectinal Histogramm Loss (our impovements)
- Continuous Histogram Loss ([paper](https://arxiv.org/pdf/2004.02830v1.pdf))

Also there are implementations of another losses to compare:
- Negative Log-Likelihood
- Binomial Deviance loss ([paper](https://arxiv.org/pdf/1407.4979.pdf))

## Installation

### Installation from source
The instalation directly from this repository:
```
https://github.com/stat-ml/hist-loss.git
cd histloss
python setup.py install
```

### Pip Installation
```
pip install hist-loss
```

## Example of usage

```Python
criterion = HistogramLoss()
positive = torch.sigmoid(torch.randn(10, requires_grad=True))
negative = torch.sigmoid(torch.randn(10, requires_grad=True))
loss = criterion(positive, negative)
loss.backward()
```