nntoolbox.losses.pinball module¶
-
class
nntoolbox.losses.pinball.
PinballLoss
(tau: float = 0.5, reduction: str = 'mean')[source]¶ Bases:
torch.nn.modules.module.Module
Pinball loss for quantile regression:
L_tau(y_true, y_pred) = max(tau * (y_true - y_pred), (tau - 1) * (y_true - y_pred))
References:
https://www.tensorflow.org/addons/api_docs/python/tfa/losses/PinballLoss
Ingo Steinwart and Andreas Christmann, “Estimating conditional quantiles with the help of the pinball loss.” https://projecteuclid.org/download/pdfview_1/euclid.bj/1297173840
-
forward
(input: torch.Tensor, target: torch.Tensor) → torch.Tensor[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
training
: bool¶
-