pub fn pseudo_huber(delta: f64, r: f64) -> f64Expand 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.