pub enum RobustLoss {
Mse,
Huber {
delta: f64,
},
Trimmed {
alpha: f64,
},
}Expand description
A loss function for fitting an expression’s constants to data.
Variants§
Mse
Mean-squared error (no robustness). Every residual gets full quadratic weight.
Huber
Huber loss: quadratic for |r| ≤ delta, linear beyond. delta is the quadratic-to-linear
transition; smaller delta is more aggressive at down-weighting outliers.
Trimmed
Trimmed MSE: discard the largest alpha fraction of squared residuals before averaging.
alpha ∈ [0, 1); e.g. alpha = 0.1 ignores the worst 10% of points.
Implementations§
Source§impl RobustLoss
impl RobustLoss
Sourcepub fn cost(self, residuals: &[f64]) -> f64
pub fn cost(self, residuals: &[f64]) -> f64
The scalar loss (mean over points) for a residual vector r = prediction − target.
Sourcepub fn irls_weight(self, r: f64, residuals: &[f64]) -> f64
pub fn irls_weight(self, r: f64, residuals: &[f64]) -> f64
The IRLS multiplicative weight w_i applied to residual row i (and the matching Jacobian
row) so that a weighted least-squares step descends the robust objective. residuals is the
full current residual vector (needed by the trimmed loss to find its quantile threshold).
Trait Implementations§
Source§impl Clone for RobustLoss
impl Clone for RobustLoss
Source§fn clone(&self) -> RobustLoss
fn clone(&self) -> RobustLoss
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RobustLoss
Source§impl Debug for RobustLoss
impl Debug for RobustLoss
Source§impl Default for RobustLoss
impl Default for RobustLoss
Source§fn default() -> RobustLoss
fn default() -> RobustLoss
Source§impl<'de> Deserialize<'de> for RobustLoss
impl<'de> Deserialize<'de> for RobustLoss
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for RobustLoss
impl PartialEq for RobustLoss
Source§fn eq(&self, other: &RobustLoss) -> bool
fn eq(&self, other: &RobustLoss) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for RobustLoss
impl Serialize for RobustLoss
impl StructuralPartialEq for RobustLoss
Auto Trait Implementations§
impl Freeze for RobustLoss
impl RefUnwindSafe for RobustLoss
impl Send for RobustLoss
impl Sync for RobustLoss
impl Unpin for RobustLoss
impl UnsafeUnpin for RobustLoss
impl UnwindSafe for RobustLoss
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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.