scipy.special.huber#

scipy.special.huber(delta, r) = <ufunc 'huber'>#

Huber loss function.

\[\begin{split}\text{huber}(\delta, r) = \begin{cases} \infty & \delta < 0 \\ \frac{1}{2}r^2 & 0 \le \delta, | r | \le \delta \\ \delta ( |r| - \frac{1}{2}\delta ) & \text{otherwise} \end{cases}\end{split}\]
Parameters
deltandarray

Input array, indicating the quadratic vs. linear loss changepoint.

rndarray

Input array, possibly representing residuals.

Returns
resndarray

The computed Huber loss function values.

Notes

This function is convex in r.

New in version 0.15.0.