huber_loss#

ray.rllib.utils.numpy.huber_loss(x: ndarray, delta: float = 1.0) → ndarray[source]#

Computes the element-wise Huber loss.

Reference: https://en.wikipedia.org/wiki/Huber_loss.

Parameters:
  • x (ndarray) – The input values, such as the differences between predictions and targets.

  • delta (float) – The threshold at which the loss switches from quadratic to linear.

Returns:

0.5 * x**2 where abs(x) < delta, and delta * (abs(x) - 0.5 * delta) elsewhere.

Return type:

ndarray