Git Product home page Git Product logo

geomstats's Introduction

Geomstats

PyPI versionBuild StatusCoverage StatusCoverage StatusCoverage Status (Coverages for: numpy, tensorflow, pytorch)

Geomstats is an open-source Python package for computations and statistics on manifolds. The package is organized into two main modules: geometry and learning.

The module geometry implements concepts in differential geometry, and the module learning implements statistics and learning algorithms for data on manifolds.

Install geomstats via pip3

From a terminal (OS X & Linux), you can install geomstats and its requirements with pip3 as follows:

pip3 install geomstats

This method installs the latest version of geomstats that is uploaded on PyPi. Note that geomstats is only available with Python3.

Install geomstats via Git

From a terminal (OS X & Linux), you can install geomstats and its requirements via git as follows:

git clone https://github.com/geomstats/geomstats.git
pip3 install -r requirements.txt

This method installs the latest GitHub version of geomstats. Developers should install this version, together with the development requirements and the optional requirements to enable tensorflow and pytorch backends:

pip3 install -r dev-requirements.txt -r opt-requirements.txt

Choose the backend

Geomstats can run seemlessly with numpy, tensorflow or pytorch. Note that pytorch and tensorflow requirements are optional, as geomstats can be used with numpy only. By default, the numpy backend is used. The visualizations are only available with this backend.

To get the tensorflow and pytorch versions compatible with geomstats, install the optional requirements:

pip3 install -r opt-requirements.txt

You can choose your backend by setting the environment variable GEOMSTATS_BACKEND to numpy, tensorflow or pytorch, and importing the backend module. From the command line:

export GEOMSTATS_BACKEND=pytorch

and in the Python3 code:

import geomstats.backend as gs

Getting started

To use geomstats for learning algorithms on Riemannian manifolds, you need to follow three steps:

  • instantiate the manifold of interest,
  • instantiate the learning algorithm of interest,
  • run the algorithm.

The data should be represented by a gs.array. This structure represents numpy arrays, or tensorflow/pytorch tensors, depending on the choice of backend.

The following code snippet shows the use of tangent Principal Component Analysis on simulated data on the space of 3D rotations.

from geomstats.geometry.special_orthogonal import SpecialOrthogonal
from geomstats.learning.pca import TangentPCA

so3 = SpecialOrthogonal(n=3)
metric = so3.bi_invariant_metric

data = so3.random_uniform(n_samples=10)

tpca = TangentPCA(metric=metric, n_components=2)
tpca = tpca.fit(data)
tangent_projected_data = tpca.transform(data)

All geometric computations are performed behind the scenes. The user only needs a high-level understanding of Riemannian geometry. Each algorithm can be used with any of the manifolds and metric implemented in the package.

To see additional examples, go to the examples directory.

Contributing

See our contributing guidelines!

Acknowledgements

This work is supported by:

  • the Inria-Stanford associated team GeomStats,
  • the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation program (grant agreement G-Statistics No. 786854),
  • the French society for applied and industrial mathematics (SMAI),
  • the National Science Foundation (grant NSF DMS RTG 1501767).

geomstats's People

Contributors

ninamiolane avatar nguigs avatar hzaatiti avatar johmathe avatar nkoep avatar cshewmake2 avatar opeltre avatar pchauchat avatar ythanwerdas avatar tgeral68 avatar alebrigant avatar stefanheyder avatar xpennec avatar est271 avatar yanncabanes avatar oleg-kachan avatar hhajri avatar effigies avatar deepsourcebot avatar dependabot[bot] avatar loopylangur 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.