Skip to content

stat-ml/hist-loss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI version Build Status PyPI license

Histogram Based Losses

This library contains implementations of some histogram-based loss functions:

  • Earth Mover Distrance Loss
  • Histgramm Loss (paper, original code)
  • Inverse Histogram Loss (our impovements)
  • Bidirectinal Histogramm Loss (our impovements)
  • Continuous Histogram Loss (paper)

Also there are implementations of another losses to compare:

  • Negative Log-Likelihood
  • Binomial Deviance loss (paper)

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

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()