## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
Constantine
@Nehoroshiy
Hello! Is it right that you want automatic differentiation for all of your manifolds?
Paul Constantine
@paulcon
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
@nkoep
You can pass an initial guess to a solver
Paul Constantine
@paulcon
Great! How?
Niklas Koep
@nkoep
just pass the point to the solve method via the keyword argument "x"
Sorry, accidently sent the message without the second part ;)
Paul Constantine
@paulcon
like: xopt = solver.solve(problem, x=xinit)
Niklas Koep
@nkoep
Yep
Paul Constantine
@paulcon
Thanks! I'm excited about this software. I'll let you know how it makes its way into my experiments.
Simon
@SimonDanisch
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

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

P = np.eye(m)
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)
Jamie Townsend
@j-towns
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
Simon
@SimonDanisch
Thanks you! I will try that out
icshen
@jdily
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
@HarshTrivedi

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:
sess.run(tf.global_variables_initializer())

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)

print(solution)

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 :)

mcomin
@massimilianocomin
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 !
Mojmir
@Mojusko
How realistic is pytorch support?
Mojmir
@Mojusko
Is there a simple hack to support it via custom grad/hess functions?
Yigit Sever
@yigitsever
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?
sweichwald
@sweichwald
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
@yapdianang
Hi! I'm looking at using this to obtain Grassmannian manifolds with maximum line packing liek this:
https://www.mathworks.com/matlabcentral/fileexchange/41652-grassmannian-design-package
but for real values. What would be the cost for line packings then? Thank you!
Christoph Heindl
@cheind
hi, anyone active?
Tanoy
@Tankiit

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
Tanoy
@Tankiit
Ok seems like removing tensorflow is the key !!!
Jamie Townsend
@j-towns

Ok seems like removing tensorflow is the key !!!

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

Kristian Eschenburg
@kristianeschenburg
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...
Tanoy
@Tankiit
@kristianeschenburg could you write what you have attempted ? Ideally your cost function
kmaggs
@kmaggs
Hi all, I am having the same problem as @Tankiit. Could someone help me by explaining how to remove tensorflow from this pipeline? Or even better, if there is a way to fix the error without removing tensorflow. Cheers!
Jamie Townsend
@j-towns
i think literally uninstalling TF should work; might be worth posting an issue on the Github because that's not an ideal solution for everyone
kmaggs
@kmaggs
thanks for fast reply! Uninstalling TF worked -- however, I will post an issue Github incase other people are having the same problem!
sfe1
@liumiao-p

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:
sess.run(tf.global_variables_initializer())

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)

print(solution)

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 am just getting started with pymanopt ! If possible,can anyone tell me what "verbosity" parameter means in the initialization of "Problem"?

Julien Clancy
@jec99

hi, I'm trying to use pymanopt, but when i pip install the package it somehow doesn't install the optimizers - i can do import pymanopt.manifolds, but not import pymanopt.optimizers. any idea what's going on? if i try to pip install directly from github, it fails with the message

WARNING: Built wheel for pymanopt is invalid: Metadata 1.2 mandates PEP 440 version, but 'dev' is not
Failed to build pymanopt
ERROR: Could not build wheels for pymanopt, which is required to install pyproject.toml-based project

Julien Clancy
@jec99
update: solved by switching the version in the two _version files to 0.2.5 instead of "dev"
Niklas Koep
@nkoep
Hey @jec99 :wave: We will release a new version of pymanopt to pypi today that should make this workaround unnecessary. As an aside: you also could have installed the package from github with pip install --no-use-pep517 git+https://github.com/pymanopt/pymanopt. That skips the metadata checks. The issue is in fact that on our master branch the version is always dev. We only substitute a proper version number when we're building release packages