pub struct GradientDescent {
pub learning_rate: f64,
pub max_iter: usize,
pub tol: f64,
}Expand description
Gradient descent optimizer.
Fields§
§learning_rate: f64Fixed learning rate.
max_iter: usizeMaximum number of iterations.
tol: f64Convergence tolerance (on gradient norm).
Implementations§
Source§impl GradientDescent
impl GradientDescent
Sourcepub fn new(lr: f64, max_iter: usize, tol: f64) -> Self
pub fn new(lr: f64, max_iter: usize, tol: f64) -> Self
Create a new gradient descent optimizer.
Sourcepub fn backtracking_line_search<F: ConvexFunction>(
f: &F,
x: &[f64],
grad: &[f64],
) -> f64
pub fn backtracking_line_search<F: ConvexFunction>( f: &F, x: &[f64], grad: &[f64], ) -> f64
Backtracking line search satisfying the Armijo condition.
Returns a step size α such that f(x - α ∇f(x)) ≤ f(x) - c₁ α ‖∇f(x)‖².
Trait Implementations§
Source§impl Clone for GradientDescent
impl Clone for GradientDescent
Source§fn clone(&self) -> GradientDescent
fn clone(&self) -> GradientDescent
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 GradientDescent
impl RefUnwindSafe for GradientDescent
impl Send for GradientDescent
impl Sync for GradientDescent
impl Unpin for GradientDescent
impl UnsafeUnpin for GradientDescent
impl UnwindSafe for GradientDescent
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