Source-linked AI summary

Pymanopt: A Python Toolbox for Optimization on Manifolds using Automatic Differentiation

James Townsend, Niklas Koep, Sebastian Weichwald

arXiv:1603.03236v4cs.MScs.LGmath.OCstat.ML

TL;DR

Optimization on manifolds offers a framework for constrained optimization, but differential geometry and derivative calculations make experimentation difficult. Pymanopt provides a Python toolbox combining manifold geometries and solvers with automated differentiation. The resulting workflow requires users to define a manifold and cost function, choose a solver, and readily experiment with alternative objectives.

  • Problem

    Differential-geometric technicalities and laborious derivative calculations make optimization on manifolds difficult to experiment with.

  • Method

    Pymanopt combines manifold geometries and optimization algorithms with automated differentiation for cost functions on vectors, matrices, and higher-rank tensors.

  • Results

    Pymanopt reduces setup to instantiating a manifold, defining a cost function, and choosing a solver, while supporting rapid experimentation with alternative objectives.

  • Takeaways & Limitations

    Pymanopt makes state-of-the-art manifold solvers, including Riemannian Trust Regions, easier to use for prototyping and related experiments.

Abstract

from arXiv · show

Optimization on manifolds is a class of methods for optimization of an objective function, subject to constraints which are smooth, in the sense that the set of points which satisfy the constraints admits the structure of a differentiable manifold. While many optimization problems are of the described form, technicalities of differential geometry and the laborious calculation of derivatives pose a significant barrier for experimenting with these methods. We introduce Pymanopt (available at https://pymanopt.github.io), a toolbox for optimization on manifolds, implemented in Python, that---similarly to the Manopt Matlab toolbox---implements several manifold geometries and optimization algorithms. Moreover, we lower the barriers to users further by using automated differentiation for calculating derivative information, saving users time and saving them from potential calculation and implementation errors.

1. Introduction

Optimization on manifolds applies optimization to smooth constraint sets, but derivative calculations can be difficult and error prone. Pymanopt addresses this barrier with automated differentiation and a simple solver-based workflow.

  • Optimization on manifolds searches over smooth spaces that admit differentiable-manifold structure, including spheres, positive definite matrices, orthogonal matrices, and Grassmann manifolds.
  • Derivative calculations become particularly laborious and error prone for objectives involving matrices or higher-rank tensors.Second-order directional derivatives required by Riemannian Trust Regions methods are especially challenging for users to derive.
  • Pymanopt uses automated differentiation to calculate derivative information for cost functions acting on vectors, matrices, and higher-rank tensors.The paper uses “automated differentiation” to include automatic and symbolic differentiation approaches.
  • Users need only instantiate a manifold, define a cost function, and choose a Pymanopt solver.This makes the Riemannian Trust Regions solver as easy to use as derivative-free or first-order methods.

2. The Potential of Optimization on Manifolds and Pymanopt Use Cases

Optimization on manifolds has been applied across machine learning and other fields, with examples including Gaussian-mixture inference, matrix completion, robust PCA, and independent component analysis.

  • Optimization on manifolds has been reported to outperform standard algorithms on a number of problems.
  • For mixture-of-Gaussians inference, a product-manifold method optimizes a reparameterized likelihood with the same local optima as the original objective.The method is reported as comparable to expectation maximization and having less variability in running times.
  • Applications include matrix completion, robust PCA, dimension reduction for ICA, kernel ICA, and similarity learning.

3. Implementation

Pymanopt is an open-source Python toolbox built around NumPy and SciPy, with multiple automated-differentiation backends and a modular structure designed for extension.

  • Pymanopt uses NumPy and SciPy for computation and linear algebra operations.
  • The toolbox supports cost functions defined using Autograd, Theano, or TensorFlow.
  • Pymanopt and its required software are open source and do not depend on proprietary software.
  • Theano uses symbolic differentiation, whereas Autograd and TensorFlow use reverse-mode automatic differentiation.
  • Its modular, commented codebase is intended to simplify adding solvers, manifolds, and automated-differentiation backends.User and developer documentation are also provided.

4. Usage: A Simple Instructive Example

A low-rank positive semidefinite matrix approximation illustrates Pymanopt’s workflow: define a manifold and cost, select a solver, and let automated differentiation handle derivatives.

  • Workflow: Pymanopt’s example requires defining a manifold, a cost function, and a solver before solving the optimization problem.
  • Problem formulation: The example seeks a rank-k positive semidefinite n × n matrix S approximating a symmetric n × n matrix A.The constraint is expressed using the manifold of positive semidefinite matrices with fixed rank k < n.
  • Problem formulation: The approximation uses a pseudo-Huber loss, which is robust against outliers and transitions between approximately absolute-value and quadratic behavior.
  • Workflow: The fixed-rank PSD manifold parameterizes points as YY^T, where Y is an n × k matrix.
  • Workflow: The solver returns Y, after which the approximation is reconstructed as S = YY^T.

5. Conclusion

Pymanopt makes experimentation with manifold optimization solvers easier by eliminating repeated manual differentiation. Users can change cost functions and run related experiments without re-deriving gradients and Hessians each time.

  • Pymanopt enables experimentation with different state-of-the-art manifold solvers without extra effort.
  • Changing cost functions, such as replacing the pseudo-Huber loss with a norm, requires only a small definition change.
  • For complex problems, automated differentiation supports related experiments without repeatedly deriving gradients and Hessians by hand.
  • Gradients and Hessians need manual derivation only when required for other analysis.
  • The authors suggest that extensibility to large-scale TensorFlow applications could advance manifold-optimization applications.
Loading 1603.03236v4…