epiout.optimizer

Module Contents

Classes

BackwardLineSearchGD

Functions

backward_linesearch_gd(loss_fn, initial_position, args=(), max_iterations=10, tol=1e-05, decay_rate=0.5, c1=10**(-4), c2=0.9, boundary=None, parallel_iterations=10)

Attributes

_LineSearchStep

_LineSearchResult

epiout.optimizer._LineSearchStep
epiout.optimizer._LineSearchResult
class epiout.optimizer.BackwardLineSearchGD(loss_fn, max_iterations=10, tol=1e-05, decay_rate=0.5, c1=10 ** - 4, c2=0.9, boundary=None, parallel_iterations=10)
_update(self, x, grad, lr)
Update variable based on gradients and learning rate

and clip if values outside of boundries.

Parameters
  • x – Variable to update

  • grad – Gradients

  • lr – Learning rate

_wilfe_condition(self, lr, step)

Wilfe condition

https://en.wikipedia.org/wiki/Wolfe_conditions

Parameters
  • lr – Initial learning rate.

  • step – _LineSearchStep object

_lr_decay(self, cond, lr, step)

Decay learning rate for the conditions.

_line_search_cond(self, cond, lr, step)
Stop condition of line search. If all conditions

are False linear search stops.

Backward line search.

Parameters
  • x – Variable to optimize (input of the loss function).

  • loss – Loss values

  • grad – Gradients vector

  • direction – Direction of line search (same with gradients if univariate function)

_loss_grad(self, x, args)

Calcualtes loss and grad given input x.

Parameters

x – Variable to optimize (input of the loss function).

_fit(self, x, args=())

One iteration of gradient decent with line search.

Parameters

x – Variable to optimize (input of the loss function).

fit(self, initial_position, args=(), history=False)

Optimize in variable in paralel

Parameters
  • initial_position – Initial values of variable.

  • history – Store loss history in the output.

epiout.optimizer.backward_linesearch_gd(loss_fn, initial_position, args=(), max_iterations=10, tol=1e-05, decay_rate=0.5, c1=10 ** - 4, c2=0.9, boundary=None, parallel_iterations=10)