Skip to content

Instantly share code, notes, and snippets.

@kellertuer
Created March 27, 2020 18:30
Show Gist options
  • Save kellertuer/61d83d4855eb159081c24425725d08fd to your computer and use it in GitHub Desktop.
Save kellertuer/61d83d4855eb159081c24425725d08fd to your computer and use it in GitHub Desktop.
The median example for Manopt 0.1.0
using Manopt, Random #for Manopt 0.1.0
Random.seed!(42); σ = π/8; n=100;
M = Hyperbolic(2)
p = HnPoint([0., 0., 1.])
data = [ addNoise(M,p) for i=1:100]
cost = y -> sum( 1/(2*n) * distance.(Ref(M),Ref(y),data))
proxes = Function[ (λ,y) -> proxDistance(M,λ/n,di,y,1) for di in data ]
m1 = cyclicProximalPoint(M, cost, proxes, data[1]; stoppingCriterion=stopAfterIteration(1000))
o = cyclicProximalPoint(M, cost, proxes, data[1];
debug = [:Iteration," | ", :x, " | ", :Change, " | ", :Cost, "\n", 50, :Stop],
record = [:Iteration, :Change, :Cost],
returnOptions = true
);
m2 = getSolverResult(o)
m3 = median(M, data) # or call it directly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment