A library for optimization on Riemannian manifolds
A library for manifold-constrained optimization in TensorFlow.
To install the latest development version from GitHub:
pip install git+https://github.com/master/tensorflow-riemopt.git
To install a package from PyPI:
pip install tensorflow-riemopt
The core package implements concepts in differential geometry, such as
manifolds and Riemannian metrics with associated exponential and logarithmic
maps, geodesics, retractions, and transports. For manifolds, where closed-form
expressions are not available, the library provides numerical approximations.
import tensorflow_riemopt as riemopt
S = riemopt.manifolds.Sphere()
x = S.projx(tf.constant([0.1, -0.1, 0.1]))
u = S.proju(x, tf.constant([1., 1., 1.]))
v = S.proju(x, tf.constant([-0.7, -1.4, 1.4]))
y = S.exp(x, v)
u_ = S.transp(x, y, u)
v_ = S.transp(x, y, v)
manifolds.Cholesky - manifold of lower triangular matrices with positive diagonal elementsmanifolds.Euclidian - unconstrained manifold with the Euclidean metricmanifolds.Grassmannian - manifold of p-dimensional linear subspaces of the n-dimensional spacemanifolds.Hyperboloid - manifold of n-dimensional hyperbolic space embedded in the n+1-dimensional Minkowski spacemanifolds.Poincare - the Poincaré ball model of the hyperbolic spacemanifolds.Product - Cartesian product of manifoldsmanifolds.SPDAffineInvariant - manifold of symmetric positive definite (SPD) matrices endowed with the affine-invariant metricmanifolds.SPDLogCholesky - SPD manifold with the Log-Cholesky metricmanifolds.SPDLogEuclidean - SPD manifold with the Log-Euclidean metricmanifolds.SpecialOrthogonal - manifold of rotation matricesmanifolds.Sphere - manifold of unit-normalized pointsmanifolds.StiefelEuclidean - manifold of orthonormal p-frames in the n-dimensional space endowed with the Euclidean metricmanifolds.StiefelCanonical - Stiefel manifold with the canonical metricmanifolds.StiefelCayley - Stiefel manifold the retraction map via an iterative Cayley transformConstrained optimization algorithms work as drop-in replacements for Keras
optimizers for sparse and dense updates in both Eager and Graph modes.
optimizers.RiemannianSGD - Riemannian Gradient Descentoptimizers.RiemannianAdam - Riemannian Adam and AMSGradoptimizers.ConstrainedRMSProp - Constrained RMSProplayers.ManifoldEmbedding - constrained keras.layers.Embedding layerIf you find TensorFlow RiemOpt useful in your research, please cite:
@misc{smirnov2021tensorflow,
title={TensorFlow RiemOpt: a library for optimization on Riemannian manifolds},
author={Oleg Smirnov},
year={2021},
eprint={2105.13921},
archivePrefix={arXiv},
primaryClass={cs.MS}
}
For support or development inquiries, contact us at: tensorflow-riemopt-dev@googlegroups.com
TensorFlow RiemOpt was inspired by many similar projects:
The code is MIT-licensed.