Skip to main content

pseudo_huber

Function pseudo_huber 

Source
pub fn pseudo_huber(delta: f64, r: f64) -> f64
Expand description

Pseudo-Huber Loss function

$$ \widetilde{L}_\delta(r) = \delta^2 \left( \sqrt{ 1 + \left( \frac{r}{\delta} \right)^2 } - 1 \right) $$

Translated from scipy.special.pseudo_huber into pure Rust.

§Notes

Like huber, pseudo_huber often serves as a robust loss function in statistics or machine learning to reduce the influence of outliers. Unlike huber, pseudo_huber is smooth.

Typically, $r$ represents residuals, the difference between a model prediction and data. Then, for $|r| \leq \delta$, pseudo_huber resembles the squared error and for $|r| > \delta$ the absolute error. This way, the Pseudo-Huber loss often achieves a fast convergence in model fitting for small residuals like the squared error loss function and still reduces the influence of outliers ($|r| > \delta$) like the absolute error loss. As $\delta$ is the cutoff between squared and absolute error regimes, it has to be tuned carefully for each problem. pseudo_huber is also convex, making it suitable for gradient based optimization 1 2.

§See also


  1. Hartley, Zisserman, “Multiple View Geometry in Computer Vision”. 2003. Cambridge University Press. p. 619 ↩

  2. Charbonnier et al. “Deterministic edge-preserving regularization in computed imaging”. 1997. IEEE Trans. Image Processing. 6 (2): 298 - 311 ↩