Stochastic gradient descent
Manopt.stochastic_gradient_descent
— Functionstochastic_gradient_descent(M, grad_f, p; kwargs...)
stochastic_gradient_descent(M, msgo, p; kwargs...)
perform a stochastic gradient descent
Input
M
: a manifold $\mathcal M$grad_f
: a gradient function, that either returns a vector of the subgradients or is a vector of gradientsp
: an initial value $x ∈ \mathcal M$
alternatively to the gradient you can provide an ManifoldStochasticGradientObjective
msgo
, then using the cost=
keyword does not have any effect since if so, the cost is already within the objective.
Optional
cost
: (missing
) you can provide a cost function for example to track the function valueevaluation
: (AllocatingEvaluation
) specify whether the gradients works by allocation (default) formgradF(M, x)
orInplaceEvaluation
in place of the formgradF!(M, X, x)
(elementwise).evaluation_order
: (:Random
) specify whether to use a randomly permuted sequence (:FixedRandom
), a per cycle permuted sequence (:Linear
) or the default:Random
one.stopping_criterion
: (StopAfterIteration
(1000)
) aStoppingCriterion
stepsize
: (ConstantStepsize
(1.0)
) aStepsize
order_type
: (:RandomOder
) a type of ordering of gradient evaluations. Possible values are:RandomOrder
, a:FixedPermutation
,:LinearOrder
order
: ([1:n]
) the initial permutation, wheren
is the number of gradients ingradF
.retraction_method
: (default_retraction_method(M, typeof(p))
) a retraction to use.
Output
the obtained (approximate) minimizer $p^*$, see get_solver_return
for details
Manopt.stochastic_gradient_descent!
— Functionstochastic_gradient_descent!(M, grad_f, p)
stochastic_gradient_descent!(M, msgo, p)
perform a stochastic gradient descent in place of p
.
Input
M
: a manifold $\mathcal M$grad_f
: a gradient function, that either returns a vector of the subgradients or is a vector of gradientsp
: an initial value $p ∈ \mathcal M$
Alternatively to the gradient you can provide an ManifoldStochasticGradientObjective
msgo
, then using the cost=
keyword does not have any effect since if so, the cost is already within the objective.
for all optional parameters, see stochastic_gradient_descent
.
State
Manopt.StochasticGradientDescentState
— TypeStochasticGradientDescentState <: AbstractGradientDescentSolverState
Store the following fields for a default stochastic gradient descent algorithm, see also ManifoldStochasticGradientObjective
and stochastic_gradient_descent
.
Fields
p
: the current iteratedirection
: (StochasticGradient
) a direction update to usestopping_criterion
: (StopAfterIteration
(1000)
) aStoppingCriterion
stepsize
: (ConstantStepsize
(1.0)
) aStepsize
evaluation_order
: (:Random
) specify whether to use a randomly permuted sequence (:FixedRandom
), a per cycle permuted sequence (:Linear
) or the default:Random
one.order
: the current permutationretraction_method
: (default_retraction_method(M, typeof(p))
) aretraction(M, p, X)
to use.
Constructor
StochasticGradientDescentState(M, p)
Create a StochasticGradientDescentState
with start point p
. all other fields are optional keyword arguments, and the defaults are taken from M
.
Additionally, the options share a DirectionUpdateRule
, so you can also apply MomentumGradient
and AverageGradient
here. The most inner one should always be.
Manopt.AbstractGradientGroupProcessor
— TypeAbstractStochasticGradientDescentSolverState <: AbstractManoptSolverState
A generic type for all options related to stochastic gradient descent methods
Manopt.StochasticGradient
— TypeStochasticGradient <: AbstractGradientGroupProcessor
The default gradient processor, which just evaluates the (stochastic) gradient or a subset thereof.
Constructor
StochasticGradient(M::AbstractManifold; p=rand(M), X=zero_vector(M, p))
Initialize the stochastic Gradient processor with tangent vector type of X
, where both M
and p
are just help variables.
Technical details
The stochastic_gradient_descent
solver requires the following functions of a manifold to be available
- A
retract!
(M, q, p, X)
; it is recommended to set thedefault_retraction_method
to a favourite retraction. If this default is set, aretraction_method=
does not have to be specified.