pub struct Dropout { /* private fields */ }Expand description
Dropout is a builder for Dropout regularization which is a technique that randomly sets a fraction of the weights to zero during training, effectively “dropping out” some neurons. This helps to prevent overfitting by introducing noise and forcing the network to learn more robust features.
Dropout is typically applied after the activation function in each layer during the forward propagation step.
The dropoutRate parameter determines the fraction of weights to be set to zero. A higher dropout rate means more weights will be dropped, which can help reduce overfitting but may also make the training process slower and more difficult.
Dropout is commonly used in deep neural networks with many layers and parameters, as these networks are more prone to overfitting.
Implementations§
Source§impl Dropout
impl Dropout
Sourcepub fn dropout_rate(self, dropout_rate: f32) -> Self
pub fn dropout_rate(self, dropout_rate: f32) -> Self
Set the dropout rate.
Specifies the fraction of input units to randomly set to zero during training. A higher rate increases regularization strength.
§Parameters
dropout_rate: Fraction of units to drop, in [0.0, 1.0] (e.g., 0.3 for 30%).
Sourcepub fn seed(self, seed: u64) -> Self
pub fn seed(self, seed: u64) -> Self
Set the random seed for reproducibility.
Fixes the random number generator used for dropout to ensure consistent results across runs.
§Parameters
seed: Random seed value.
pub fn build(self) -> Result<Box<dyn Regularization>, NetworkError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dropout
impl RefUnwindSafe for Dropout
impl Send for Dropout
impl Sync for Dropout
impl Unpin for Dropout
impl UnsafeUnpin for Dropout
impl UnwindSafe for Dropout
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<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.