pub struct NaturalGradient { /* private fields */ }Expand description
Natural gradient optimizer state
Implementations§
Source§impl NaturalGradient
impl NaturalGradient
Sourcepub fn with_damping(self, damping: f64) -> Self
pub fn with_damping(self, damping: f64) -> Self
Set damping factor
Sourcepub fn with_diagonal(self, use_diagonal: bool) -> Self
pub fn with_diagonal(self, use_diagonal: bool) -> Self
Use diagonal FIM approximation (faster, less memory)
Sourcepub fn step(
&mut self,
gradient: &[f64],
gradient_samples: Option<&[Vec<f64>]>,
) -> Result<Vec<f64>>
pub fn step( &mut self, gradient: &[f64], gradient_samples: Option<&[Vec<f64>]>, ) -> Result<Vec<f64>>
Compute natural gradient step
§Arguments
gradient- Standard gradient ∇Lgradient_samples- Optional gradient samples for FIM estimation
Sourcepub fn apply_update(parameters: &mut [f64], update: &[f64]) -> Result<()>
pub fn apply_update(parameters: &mut [f64], update: &[f64]) -> Result<()>
Apply update to parameters
Trait Implementations§
Source§impl Clone for NaturalGradient
impl Clone for NaturalGradient
Source§fn clone(&self) -> NaturalGradient
fn clone(&self) -> NaturalGradient
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 moreAuto Trait Implementations§
impl Freeze for NaturalGradient
impl RefUnwindSafe for NaturalGradient
impl Send for NaturalGradient
impl Sync for NaturalGradient
impl Unpin for NaturalGradient
impl UnwindSafe for NaturalGradient
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