pysolvegn.tukey_rho#
- tukey_rho(x)[source]#
Compute the Tukey biweight (bisquare) robust cost function and its derivatives.
\[\begin{split}\rho(x) = \begin{cases} \frac{1 - (1 - x)^3}{3} & \text{if } x \leq 1 \\ \frac{1}{3} & \text{otherwise} \end{cases}\end{split}\]\[\begin{split}\rho'(x) = \begin{cases} (1 - x)^2 & \text{if } x \leq 1 \\ 0 & \text{otherwise} \end{cases}\end{split}\]\[\begin{split}\rho''(x) = \begin{cases} -2(1 - x) & \text{if } x \leq 1 \\ 0 & \text{otherwise} \end{cases}\end{split}\]The residuals beyond the threshold (\(|r| > 1\)) are completely ignored (\(\rho' = 0\)). The loss is strongly non-convex: a good initial guess is required, since a point whose residuals are all beyond the threshold has a zero gradient (and a singular Hessian).
- Parameters:
x (ArrayLike) – Squared residuals \(x = \|R\|^2\). Shape
(N,).- Returns:
rho (numpy.ndarray) – The cost function values with shape
(N,).rho_prime (numpy.ndarray) – The first derivatives with shape
(N,).rho_double_prime (numpy.ndarray) – The second derivatives with shape
(N,).
- Return type:
Tuple[ndarray, ndarray, ndarray]