Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aleatoric uncertainty losses #16

Open
jimfleming opened this issue Dec 7, 2018 · 1 comment
Open

Aleatoric uncertainty losses #16

jimfleming opened this issue Dec 7, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@jimfleming
Copy link
Contributor

This paper discusses two loss functions for regression and classification losses which capture aleatoric uncertainty: https://arxiv.org/abs/1703.04977

def aleatoric_regression_loss(dist, labels, weights):
    losses = (labels - dist.loc)**2 / (2 * dist.scale**2)
    losses += (1 / 2) * log(dist.scale**2)
    loss = compute_weighted_loss(losses, weights)
    return loss
def aleatoric_classification_loss(dist, labels, weights):
    # requires sampling
    return loss

There are lots of ways of formulating these and maybe even something more direct using distributions. Open to suggestions.

@wenkesj
Copy link
Contributor

wenkesj commented Dec 10, 2018

I really like this. It seems like a nice addition on top of the tf.losses API. Should we adjust it to take the tfp.distributions.Distribution parameters directly instead? This way there isn't any assumption about the object containing the attributes and pass the loc and scale (or samples in other cases). It may not be necessary in any case, since this assumes it is a Gaussian, therefore should come from the already existing tfp API like your example.

To illustrate what I was suggesting:

def aleatoric_regression_loss(predictions_loc, predictions_scale, labels, weights):
    losses = (labels -predictions_loc)**2 / (2 * predictions_scale **2)
    losses += (1 / 2) * log(predictions_scale**2)
    loss = compute_weighted_loss(losses, weights)
    return loss
dist = tfp.distributions.MultiVariateNormalDiag(...)
loss = aleatoric_regression_loss(dist.loc, dist.scale, labels, weights)

@jimfleming jimfleming added the enhancement New feature or request label Jan 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants