Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
Hello! Is it right that you want automatic differentiation for all of your manifolds?
Paul Constantine
Is it possible to give the optimizer an initial guess for the optimal point on the manifold? Specifically, I'm optimizing on the Grassman, and I'd like to give it a particular orthogonal matrix (as a numpy array) representing a point on the Grassman as the initial guess.
Niklas Koep
You can pass an initial guess to a solver
Paul Constantine
Great! How?
Niklas Koep
just pass the point to the solve method via the keyword argument "x"
Sorry, accidently sent the message without the second part ;)
Paul Constantine
like: xopt = solver.solve(problem, x=xinit)
Niklas Koep
Paul Constantine
Thanks! I'm excited about this software. I'll let you know how it makes its way into my experiments.
Hi, I came across some very slow code and wanted to ask, if I'm doing something obvious wrong:
import autograd.numpy as np
from pymanopt.manifolds import Sphere
from pymanopt import Problem
from pymanopt.solvers import NelderMead

n = 1000; m = 8 
A = np.random.randn(m, n)

P = np.eye(m)
solver = NelderMead(maxiter = 1000)
manifold = Sphere(m) ## spherical constraint
def cost(X): return np.sum(X)

problem = Problem(
    manifold = manifold,
    cost = cost,
    verbosity = 1
import time
start = time.time()
x = solver.solve(problem)
end = time.time()
print(end - start)
this takes about 5 seconds
Jamie Townsend
Hey there, I haven't used the gradient free solvers much (NelderMead and ParticleSwarm), but when I have I've found them to be slow and impractical. I would use SteepestDescent, ConjugateGradient or TrustRegions by default
All of which should work in this case
Thanks you! I will try that out
Hi, I am interested if anyone implemented other manifold, such as rotation as the one in manopt lib?
I did one myself, but encounter some problems..
Harsh Trivedi

Can any one please help me use Pymanopt with Tensorflow code which uses placeholders (passing input X, y through feedict)?

import tensorflow as tf
import numpy as np

from pymanopt import Problem
from pymanopt.solvers import SteepestDescent
from pymanopt.manifolds import Euclidean, Product

X = tf.placeholder( tf.float32, [ 3, 100 ] )
Y = tf.placeholder( tf.float32, [ 3, 1 ] )

w = tf.Variable(tf.zeros([3, 1]))
b = tf.Variable(tf.zeros([1, 1]))
cost = tf.reduce_mean(tf.square(Y - tf.matmul(tf.transpose(w), X) - b))

with tf.Session() as sess:

    solver = SteepestDescent()
    manifold = Product([Euclidean(3, 1), Euclidean(1, 1)])

    Xt = np.random.randn(3, 100).astype('float32')
    Yt = (Xt[0:1, :] - 2*Xt[1:2, :] + np.random.randn(1, 100) + 5).astype('float32')

    problem = Problem( manifold = manifold, cost = cost, arg = [w, b], verbosity=1 )
    solution = solver.solve( problem)


If possible, can anyone help me work with this toy example. I want to know how to accomodate Xt and Yt which are inputs. Note that my computational graph is defined using placeholders.
Thanks :)

Hi, I would like to know if the log-euclidean metric, and specifically the Exponential and Logarithmic maps, for symmetric positive-definite (SPD) matrices are implemented ?
I believe the current SPD manifold only implements affine-invariant metrics, am I right ?
Thanks !
How realistic is pytorch support?
Is there a simple hack to support it via custom grad/hess functions?
Yiğit Sever
hello, I'm trying to use https://github.com/anoopkunchukuttan/geomm which uses pymanopt but I'm getting ImportError: cannot import name 'ConjugateGradientMS' from 'pymanopt.solvers', I found ConjugateGradient() from the docs, has it been refactored?
Hey there! If I remember correctly we never had a ConjugateGradientMS in pymanopt and usually we aim not to break compatibility when refactoring..
Looking at https://github.com/anoopkunchukuttan/geomm/search?q=ConjugateGradientMS&unscoped_q=ConjugateGradientMS it seems it's only imported but never used, so maybe you can simply remove it from the import statement in the geomm_multi.py file?
Dian Ang
Hi! I'm looking at using this to obtain Grassmannian manifolds with maximum line packing liek this:
but for real values. What would be the cost for line packings then? Thank you!
Christoph Heindl
hi, anyone active?

In [1]: import autograd.numpy as np

In [2]: from pymanopt.manifolds import Stiefel
...: from pymanopt import Problem
...: from pymanopt.solvers import SteepestDescent

In [3]: # (1) Instantiate a manifold
...: manifold = Stiefel(5, 2)
...: # (2) Define the cost function (here using autograd.numpy)
...: def cost(X): return np.sum(X)
...: problem = Problem(manifold=manifold, cost=cost)
...: # (3) Instantiate a Pymanopt solver
...: solver = SteepestDescent()
...: # let Pymanopt do the rest
...: Xopt = solver.solve(problem)
...: print(Xopt)

Hi I am trying to run this simple example on pymanopt using autograd and seem to have AttributeError: module 'tensorflow' has no attribute 'Session' does anyone know what could be the potential problem
Ok seems like removing tensorflow is the key !!!
Jamie Townsend

Ok seems like removing tensorflow is the key !!!

This is the solution to many of the world’s problems 🙂

Kristian Eschenburg
Hi -- I am trying to use Pymanopt to formulate a geodesic regression problem on the Grassmannian -- I have dependent variables sampled from the manifold, and scalar-valued independent variables (like age, sex, other demographic information) for each sample. I'm a bit confused as to how to set this up in pymanopt...
@kristianeschenburg could you write what you have attempted ? Ideally your cost function