Struct GradientDescent

Source
pub struct GradientDescent<T> { /* private fields */ }
Expand description

A simple Gradient Descent optimizer.

Implementations§

Source§

impl GradientDescent<ArmijoLineSearch>

Source

pub fn new() -> GradientDescent<ArmijoLineSearch>

Creates a new GradientDescent optimizer using the following defaults:

  • line_search = ArmijoLineSearch(0.5, 1.0, 0.5)
  • gradient_tolerance = 1e-4
  • max_iterations = None
Source§

impl<T: LineSearch> GradientDescent<T>

Specifies the line search method to use.

Source

pub fn gradient_tolerance(self, gradient_tolerance: f64) -> Self

Adjusts the gradient tolerance which is used as abort criterion to decide whether we reached a plateau.

Source

pub fn max_iterations(self, max_iterations: Option<u64>) -> Self

Adjusts the number of maximally run iterations. A value of None instructs the optimizer to ignore the nubmer of iterations.

Trait Implementations§

Source§

impl<T: Default> Default for GradientDescent<T>

Source§

fn default() -> GradientDescent<T>

Returns the “default value” for a type. Read more
Source§

impl<F: Function1, S: LineSearch> Minimizer<F> for GradientDescent<S>

Source§

type Solution = Solution

Type of the solution the Minimizer returns.
Source§

fn minimize(&self, function: &F, initial_position: Vec<f64>) -> Solution

Performs the actual minimization and returns a solution that might be better than the initially provided one.

Auto Trait Implementations§

§

impl<T> Freeze for GradientDescent<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for GradientDescent<T>
where T: RefUnwindSafe,

§

impl<T> Send for GradientDescent<T>
where T: Send,

§

impl<T> Sync for GradientDescent<T>
where T: Sync,

§

impl<T> Unpin for GradientDescent<T>
where T: Unpin,

§

impl<T> UnwindSafe for GradientDescent<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V