Loss Functions

class softsensor.losses.BetaNLL(beta=0.15)[source]

Compute the beta negative log likelihood loss

“On the Pitfalls of Heteroscedastic Uncertainty Estimation with Probabilistic Neural Networks” [Seitzer et al. 2022 https://openreview.net/forum?id=aPOpXlnV1T]

Parameters:

beta (float in range (0, 1)) – beta parameter that defines the degree to which the gradients are weighted by predicted variance

Return type:

None

class softsensor.losses.DistributionalMSELoss[source]

Wrapper that computes MSE loss on the mean of the distribution prediction

Parameters:

None

Return type:

None

class softsensor.losses.GaussianNLLLoss[source]

Compute the Gaussian negative log likelihood loss

Heteroscedastic NLL loss for aleatoric uncertainty (equation 5) from the paper “What Uncertainties Do We Need in Bayesian Deep Learning for Computer Vision?” [Kendall & Gal 2017 https://arxiv.org/pdf/1703.04977.pdf]

Parameters:

None

Return type:

None

class softsensor.losses.PSDLoss(fs, freq_range=None, window=128, type='msle')[source]

Compute the PSD loss

Parameters:

None

Return type:

None

class softsensor.losses.PinballLoss(quantiles)[source]

Compute the Pinball loss (quantile loss)

Based on the qr loss as defined in “Estimating conditional quantiles with the help of the pinball loss” [Steinwart & Christmann 2011] https://arxiv.org/pdf/1102.2101.pdf

Parameters:

quantiles (list[x] with x float in range (0, 1)) – quantiles to compute the loss on

Return type:

None

forward(pred, target)[source]

Computes the loss

Parameters:
  • (torch.Tensor) (target)

  • (torch.Tensor)

Returns:

torch.Tensor

Return type:

loss