pub struct SquaredLoss;Expand description
Mean squared error loss (L2 loss, scaled by 0.5).
Optimal for regression when the noise is Gaussian.
Sensitive to outliers – consider HuberLoss
for heavy-tailed distributions.
Trait Implementations§
Source§impl Clone for SquaredLoss
impl Clone for SquaredLoss
Source§fn clone(&self) -> SquaredLoss
fn clone(&self) -> SquaredLoss
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SquaredLoss
impl Debug for SquaredLoss
Source§impl Loss for SquaredLoss
impl Loss for SquaredLoss
Source§fn n_outputs(&self) -> usize
fn n_outputs(&self) -> usize
Number of output dimensions (1 for regression/binary, C for multiclass).
Source§fn gradient(&self, target: f64, prediction: f64) -> f64
fn gradient(&self, target: f64, prediction: f64) -> f64
First derivative of the loss with respect to prediction: dL/df.
Source§fn hessian(&self, _target: f64, _prediction: f64) -> f64
fn hessian(&self, _target: f64, _prediction: f64) -> f64
Second derivative of the loss with respect to prediction: d^2L/df^2.
Source§fn predict_transform(&self, raw: f64) -> f64
fn predict_transform(&self, raw: f64) -> f64
Transform raw model output to final prediction (identity for regression, sigmoid for binary).
Source§fn initial_prediction(&self, targets: &[f64]) -> f64
fn initial_prediction(&self, targets: &[f64]) -> f64
Initial constant prediction (before any trees). Typically the optimal constant
that minimizes sum of losses over the given targets.
impl Copy for SquaredLoss
Auto Trait Implementations§
impl Freeze for SquaredLoss
impl RefUnwindSafe for SquaredLoss
impl Send for SquaredLoss
impl Sync for SquaredLoss
impl Unpin for SquaredLoss
impl UnsafeUnpin for SquaredLoss
impl UnwindSafe for SquaredLoss
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
Mutably borrows from an owned value. Read more