View source on GitHub |
Computes the pinball loss between y_true
and y_pred
.
@tf.function
tfa.losses.pinball_loss( y_true:
tfa.types.TensorLike
, y_pred:tfa.types.TensorLike
, tau:tfa.types.FloatTensorLike
= 0.5 ) -> tf.Tensor
loss = maximum(tau * (y_true - y_pred), (tau - 1) * (y_true - y_pred))
In the context of regression this loss yields an estimator of the tau conditional quantile.
See: https://en.wikipedia.org/wiki/Quantile_regression
Usage:
loss = tfa.losses.pinball_loss([0., 0., 1., 1.],
[1., 1., 1., 0.], tau=.1)
loss
<tf.Tensor: shape=(), dtype=float32, numpy=0.475>
Returns | |
---|---|
pinball_loss
|
1-D float Tensor with shape [batch_size].
|
References | |
---|---|