pub enum Kernel {
Squared,
Huber(f64),
Cauchy(f64),
Tukey(f64),
GemanMcClure(f64),
}Expand description
A loss function.
Each kernel’s parameter is a scale in units of the residual, that is, in metres. It sets the boundary of a “normal” error; three standard deviations of the sensor noise is a reasonable starting point.
Variants§
Squared
Squared: ρ(e) = e²/2. Not robust; kept for comparison.
Huber(f64)
Huber: quadratic near zero, linear outside.
An outlier’s contribution still grows, but only linearly. Convex, so it creates no local minima.
Cauchy(f64)
Cauchy: the contribution grows logarithmically.
Suppresses harder than Huber, at the cost of being non-convex.
Tukey(f64)
Tukey: an outlier’s contribution is exactly zero past the threshold.
The harshest of these: a point beyond the threshold has no influence at all. It demands a decent initial guess.
GemanMcClure(f64)
Geman–McClure: smooth saturation without a hard threshold.
Implementations§
Source§impl Kernel
impl Kernel
Sourcepub fn weight(self, residual: f64) -> f64
pub fn weight(self, residual: f64) -> f64
The IRLS weight w(e) = ψ(e)/e.
At zero every kernel gives one: near the origin all of them agree with the squared loss.
Trait Implementations§
impl Copy for Kernel
impl StructuralPartialEq for Kernel
Auto Trait Implementations§
impl Freeze for Kernel
impl RefUnwindSafe for Kernel
impl Send for Kernel
impl Sync for Kernel
impl Unpin for Kernel
impl UnsafeUnpin for Kernel
impl UnwindSafe for Kernel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.