huber_loss

Contents

huber_loss#

class brainpy.losses.huber_loss(predicts, targets, delta=1.0)[source]#

Huber loss.

Huber loss is similar to L2 loss close to zero, L1 loss away from zero. If gradient descent is applied to the huber loss, it is equivalent to clipping gradients of an l2_loss to [-delta, delta] in the backward pass.

Parameters:
  • predicts (ArrayType) – predictions

  • targets (ArrayType) – ground truth

  • delta (float) – radius of quadratic behavior

Returns:

loss – The loss value.

Return type:

float

References