chainerx.huber_loss

chainerx.huber_loss()

Element-wise Huber loss.

The Huber loss is similar to the squared error but is less sensitive to outliers in the data. It is defined as

\[\begin{split}L_{\delta}(a) = \left \{ \begin{array}{cc} \frac{1}{2} a^2 & {\rm if~|a| \leq \delta} \\ \delta (|a| - \frac{1}{2} \delta) & {\rm otherwise,} \end{array} \right.\end{split}\]

where \(a = x - t\) is the difference between the input \(x\) and the target \(t\).

See: Huber loss - Wikipedia.

Parameters
  • x (ndarray) – Input variable.

  • t (ndarray) – Target variable for regression.

  • delta (float) – Constant variable for Huber loss function as used in definition.

Returns

A variable object holding an array representing the Huber loss \(L_{\delta}\) of the two inputs.

Return type

ndarray