Giter Site home page Giter Site logo

jaivardhankapoor / geoopt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from geoopt/geoopt

1.0 0.0 0.0 375 KB

Riemannian Adaptive Optimization Methods with pytorch optim

Home Page: https://geoopt.readthedocs.io

License: Other

Python 98.77% Dockerfile 0.55% Shell 0.68%

geoopt's Introduction

geoopt

Python Package Index Documentation Status Build Status Coverage Status Codestyle Black Gitter

Manifold aware pytorch.optim.

Unofficial implementation for “Riemannian Adaptive Optimization Methods” ICLR2019 and more.

Installation

Make sure you have pytorch>=1.1.0 installed

There are two ways to install geoopt:

  1. GitHub (preferred so far) due to active development
pip install git+https://github.com/geoopt/geoopt.git
  1. pypi (this might be significantly behind master branch)
pip install geoopt

The preferred way to install geoopt will change once stable project stage is achieved. Now, pypi is behind master as we actively develop and implement new features.

What is done so far

Work is in progress but you can already use this. Note that API might change in future releases.

Tensors

  • geoopt.ManifoldTensor – just as torch.Tensor with additional manifold keyword argument.
  • geoopt.ManifoldParameter – same as above, recognized in torch.nn.Module.parameters as correctly subclassed.

All above containers have special methods to work with them as with points on a certain manifold

  • .proj_() – inplace projection on the manifold.
  • .proju(u) – project vector u on the tangent space. You need to project all vectors for all methods below.
  • .egrad2rgrad(u) – project gradient u on Riemannian manifold
  • .inner(u, v=None) – inner product at this point for two tangent vectors at this point. The passed vectors are not projected, they are assumed to be already projected.
  • .retr(u, t=1.) – retraction map following vector u for time t
  • .expmap(u, t=1.) – exponential map following vector u for time t (if expmap is not available in closed form, best approximation is used)
  • .transp(v, *more, u, t=1.) – transport vector v (and possibly more vectors) with direction u for time t
  • .retr_transp(v, *more, u, t=1.) – transport self, vector v (and possibly more vectors) with direction u for time t (returns are plain tensors)

Manifolds

  • geoopt.Euclidean – unconstrained manifold in R with Euclidean metric
  • geoopt.Stiefel – Stiefel manifold on matrices A in R^{n x p} : A^t A=I, n >= p
  • geoopt.Sphere - Sphere manifold ||x||=1
  • geoopt.PoincareBall - Poincare ball model (wiki)

All manifolds implement methods necessary to manipulate tensors on manifolds and tangent vectors to be used in general purpose. See more in documentation.

Optimizers

  • geoopt.optim.RiemannianSGD – a subclass of torch.optim.SGD with the same API
  • geoopt.optim.RiemannianAdam – a subclass of torch.optim.Adam

Samplers

  • geoopt.samplers.RSGLD – Riemannian Stochastic Gradient Langevin Dynamics
  • geoopt.samplers.RHMC – Riemannian Hamiltonian Monte-Carlo
  • geoopt.samplers.SGRHMC – Stochastic Gradient Riemannian Hamiltonian Monte-Carlo

geoopt's People

Contributors

ferrine avatar justanothercoder avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.