pub struct FocalLoss {
pub alpha: f64,
pub gamma: f64,
pub epsilon: f64,
}Expand description
Focal loss for addressing class imbalance. Reference: Lin et al., “Focal Loss for Dense Object Detection”
Fields§
§alpha: f64Alpha weighting factor for positive class (range: [0, 1]).
gamma: f64Gamma focusing parameter (typically 2.0).
epsilon: f64Epsilon for numerical stability.
Trait Implementations§
Source§impl Loss for FocalLoss
impl Loss for FocalLoss
Source§fn compute(
&self,
predictions: &ArrayView<'_, f64, Ix2>,
targets: &ArrayView<'_, f64, Ix2>,
) -> TrainResult<f64>
fn compute( &self, predictions: &ArrayView<'_, f64, Ix2>, targets: &ArrayView<'_, f64, Ix2>, ) -> TrainResult<f64>
Compute loss value.
Auto Trait Implementations§
impl Freeze for FocalLoss
impl RefUnwindSafe for FocalLoss
impl Send for FocalLoss
impl Sync for FocalLoss
impl Unpin for FocalLoss
impl UnwindSafe for FocalLoss
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
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>
Converts
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>
Converts
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 more