The most recent version 0.4.8 introduces a comprehensive display of the resulting solver state. To illustrate this consider a small example on computing the Riemannian center of mass
using Manopt, Manifolds
M = Sphere(2)
n=100;
p = 1 / sqrt(2) * [1.0, 0.0, 1.0];
data = [exp(M, p, π / 8 * rand(M; vector_at=p)) for _ in 1:n];
f(M, p) = sum(1 / (2 * n) * distance.(Ref(M), Ref(p), data) .^ 2);
grad_f(M, p) = sum(1 / n * grad_distance.(Ref(M), data, Ref(p)));
p_opt = gradient_descent(M, f, grad_f, data[1])
The solver call, that is the p_opt
you obtain is (just) the minimiser the gradient descent obtained. So if you just need that, this is as before.
Also before you could ask for the whole solver state at the end of the solver run using
state = gradient_descent(M, f, grad_f, data[1]; return_state=true)
But now these state structures together with a lot of internal structures have new/updated/nicer show
methods and an even shorter status_summary()
function such that this state gets displayed on REPL as
# Solver state for `Manopt.jl`s Gradient Descent
After 75 iterations
## Parameters
* retraction method: ExponentialRetraction()
## Stepsize
ArmijoLineseach() with keyword parameters
* initial_stepsize = 1.0
* retraction_method = ExponentialRetraction()
* contraction_factor = 0.95
* sufficient_decrease = 0.1
* linesearch_stopsize = 0.0
## Stopping Criterion
Stop When _one_ of the following are fulfilled:
Max Iteration 200: not reached
|Δf| < 1.0e-9: reached
Overall: reached
This indicates convergence: Yes
also including a heuristic whether the stopping criterion that did “fire” (indicate to stop) is one that indicates convergence. Note that you can easily design your own stopping criteria, since every solver in Manopt.jl has the stopping_criterion=
keywords and stopping criteria can be combined using |
and &
for example if you wand both a small change in the iterate and a small gradient – or a number of iterations as a safeguard you can do
stopping_criterion = StopAfterIteration(200) | (
StopWhenGradientNormLess(1e-9) & StopWhenChangeLess(1e-9)
)
Finally, the examples of this package will get their own “home” and have already “moved out” – they will be revised and improved in performance and then be added to ManoptExamples.jl, see this announcement.