pub struct SlbfgsOptimizer {
pub config: SlbfgsConfig,
}Expand description
Stochastic L-BFGS optimizer with optional SVRG variance reduction.
Fields§
§config: SlbfgsConfigAlgorithm configuration.
Implementations§
Source§impl SlbfgsOptimizer
impl SlbfgsOptimizer
Sourcepub fn new(config: SlbfgsConfig) -> Self
pub fn new(config: SlbfgsConfig) -> Self
Create with given configuration.
Sourcepub fn default_config() -> Self
pub fn default_config() -> Self
Create with default configuration.
Sourcepub fn minimize(
&self,
stoch_f_and_g: &dyn Fn(&[f64], &[usize]) -> (f64, Vec<f64>),
full_grad_fn: &dyn Fn(&[f64]) -> (f64, Vec<f64>),
n_samples: usize,
x0: &[f64],
) -> Result<OptResult, OptimizeError>
pub fn minimize( &self, stoch_f_and_g: &dyn Fn(&[f64], &[usize]) -> (f64, Vec<f64>), full_grad_fn: &dyn Fn(&[f64]) -> (f64, Vec<f64>), n_samples: usize, x0: &[f64], ) -> Result<OptResult, OptimizeError>
Minimize a stochastic objective function using S-L-BFGS.
§Arguments
stoch_f_and_g— stochastic oracle: givenxand a batch of indices (subset of0..n_samples), returns (f, ∇f) on that mini-batch.full_grad_fn— deterministic oracle for full gradient at snapshot:(x) → (f, ∇f)over the full dataset.n_samples— total number of data points.x0— initial point.
§Returns
An OptResult describing the found minimizer and convergence status.
Auto Trait Implementations§
impl Freeze for SlbfgsOptimizer
impl RefUnwindSafe for SlbfgsOptimizer
impl Send for SlbfgsOptimizer
impl Sync for SlbfgsOptimizer
impl Unpin for SlbfgsOptimizer
impl UnsafeUnpin for SlbfgsOptimizer
impl UnwindSafe for SlbfgsOptimizer
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for 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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.