Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/stat-ml/hist-loss
- Owner: stat-ml
- License: apache-2.0
- Created: 2021-01-03T20:18:19.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-06-14T14:53:01.000Z (over 3 years ago)
- Last Synced: 2024-09-27T20:04:33.489Z (about 2 months ago)
- Topics: earth-mover-distance, histogram-loss, pytorch
- Language: Python
- Homepage:
- Size: 43.9 KB
- Stars: 12
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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()
```