pub struct Mixup { /* private fields */ }Expand description
Mixup data augmentation (Zhang et al., 2018). Creates virtual training examples: x’ = λx_i + (1-λ)x_j
Implementations§
Source§impl Mixup
impl Mixup
Sourcepub fn sample_lambda(&self) -> f32
pub fn sample_lambda(&self) -> f32
Sample mixing coefficient from Beta(alpha, alpha).
Sourcepub fn mix_samples(
&self,
x1: &Vector<f32>,
x2: &Vector<f32>,
lambda: f32,
) -> Vector<f32>
pub fn mix_samples( &self, x1: &Vector<f32>, x2: &Vector<f32>, lambda: f32, ) -> Vector<f32>
Mix two samples: x’ = λ*x1 + (1-λ)*x2
Sourcepub fn mix_labels(
&self,
y1: &Vector<f32>,
y2: &Vector<f32>,
lambda: f32,
) -> Vector<f32>
pub fn mix_labels( &self, y1: &Vector<f32>, y2: &Vector<f32>, lambda: f32, ) -> Vector<f32>
Mix labels: y’ = λ*y1 + (1-λ)*y2
pub fn alpha(&self) -> f32
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mixup
impl RefUnwindSafe for Mixup
impl Send for Mixup
impl Sync for Mixup
impl Unpin for Mixup
impl UnwindSafe for Mixup
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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