Struct optimization::StochasticGradientDescent [] [src]

pub struct StochasticGradientDescent {
    // some fields omitted
}

Provides stochastic Gradient Descent optimization.

Methods

impl StochasticGradientDescent

fn new() -> StochasticGradientDescent

Creates a new StochasticGradientDescent optimizer using the following defaults:

  • step_width = 0.01
  • mini_batch = 1
  • max_iterations = 1000

The used random number generator is randomly seeded.

fn seed(&mut self, seed: [u32; 4]) -> &mut Self

Seeds the random number generator using the supplied seed.

This is useful to create re-producable results.

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

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

fn mini_batch(&mut self, mini_batch: usize) -> &mut Self

Adjusts the mini batch size, i.e., how many terms are considered in one step at most.

fn step_width(&mut self, step_width: f64) -> &mut Self

Adjusts the step size applied for each mini batch.

Trait Implementations

impl<F: Summation1> Minimizer<F> for StochasticGradientDescent

type Solution = Solution

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