Skip to main content

Geometric statistics on manifolds

Project description

Geomstats logo

Geomstats is a Python package for computations, statistics, machine learning and deep learning on manifolds.

The package is organized into two main modules: geometry and learning. The module geometry implements differential geometry: manifolds, Lie groups, fiber bundles, shape spaces, information manifolds, Riemannian metrics, and more. The module learning implements statistics and learning algorithms for data on manifolds. Users can choose between backends: NumPy, Autograd or PyTorch.

Code

PyPI versionDownloads Zenodo

Continuous Integration

Build Statuspython

Code coverage (np, autograd, torch)

Coverage Status npCoverage Status autogradCoverage Status torch

Documentation

doc bindertutorial

Community

contributions Slack Twitter

Keep in touch with the community by joining us on our slack workspace!

NEWS:

Citing Geomstats

If you find geomstats useful, please kindly cite:

@article{JMLR:v21:19-027,
  author  = {Nina Miolane and Nicolas Guigui and Alice Le Brigant and Johan Mathe and Benjamin Hou and Yann Thanwerdas and Stefan Heyder and Olivier Peltre and Niklas Koep and Hadi Zaatiti and Hatem Hajri and Yann Cabanes and Thomas Gerald and Paul Chauchat and Christian Shewmake and Daniel Brooks and Bernhard Kainz and Claire Donnat and Susan Holmes and Xavier Pennec},
  title   = {Geomstats:  A Python Package for Riemannian Geometry in Machine Learning},
  journal = {Journal of Machine Learning Research},
  year    = {2020},
  volume  = {21},
  number  = {223},
  pages   = {1-9},
  url     = {http://jmlr.org/papers/v21/19-027.html}
}

We would sincerely appreciate citations to both the original research paper and the software version, to acknowledge authors who started the codebase and made the library possible, together with the crucial work of all contributors who are continuously implementing pivotal new geometries and important learning algorithms, as well as refactoring, testing and documenting the code to democratize geometric statistics and (deep) learning and foster reproducible research in this field.

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 conda

From a terminal (OS X & Linux) or an Anaconda prompt (Windows), you can install geomstats and its requirements with conda as follows:

conda install -c conda-forge geomstats

This method installs the latest version of geomstats that is uploaded on conda-forge. 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
cd geomstats
pip3 install .

This method installs the latest GitHub version of geomstats.

Note that this only installs the minimum requirements. To add the optional, development, continuous integration and documentation requirements, refer to the file pyproject.toml.

Install geomstats : Developers

Developers should git clone the main branch of this repository, together with the development requirements and the optional requirements to enable autograd and pytorch backends:

pip3 install geomstats[dev,opt]

Additionally, we recommend installing our pre-commit hook, to ensure that your code follows our Python style guidelines:

pre-commit install

Choose the backend

Geomstats can run seamlessly with numpy, autograd or pytorch. Note that autograd and pytorch and 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 autograd and pytorch versions compatible with geomstats, install the optional requirements:

pip3 install geomstats[opt]

To install only the requirements for a given backend do:

pip3 install geomstats[<backend_name>]

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

export GEOMSTATS_BACKEND=<backend_name>

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, autograd or 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, point_type="vector")

data = so3.random_uniform(n_samples=10)

tpca = TangentPCA(space=so3, 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 or notebooks directories.

Contributing

See our contributing guidelines!

Interested? Contact us and join the next hackathons. Previous Geomstats events include:

  • January 2020: hackathon at Inria Sophia-Antipolis, Nice, France

  • April 2020: remote online hackathon

  • March - April 2021: hackathon, hybrid at Inria Sophia-Antipolis / remotely with contributors from around the world

  • July 2021: hackathon at the Geometric Science of Information (GSI) conference, Paris, France

  • August 2021: international Coding Challenge at the International Conference on Learning Representations (ICLR), remotely

  • December 2021: fixit hackathon at the Sorbonne Center for Artificial Intelligence, Paris, France.

  • February 2022: hackathon, hybrid at Inria Sophia-Antipolis / remotely with contributors from around the world

  • April 2022: in-person hackathon at the Villa Cynthia, Saint Raphael, France.

  • April 2022: international Coding Challenge at the International Conference on Learning Representations (ICLR), remotely.

  • June 2022: hackathon at the University of Washington (UW).

  • October 17-21, 2022: hackathon during the trimester Geometry and Statistics in Data Sciences, in Paris.

Acknowledgements

This work is supported by:

  • the National Science Foundation (grant 2313150).

  • the National Science Foundation (NSF CAREER award, grant 2240158).

  • 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).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geomstats-2.8.0.tar.gz (9.9 MB view details)

Uploaded Source

Built Distribution

geomstats-2.8.0-py3-none-any.whl (10.5 MB view details)

Uploaded Python 3

File details

Details for the file geomstats-2.8.0.tar.gz.

File metadata

  • Download URL: geomstats-2.8.0.tar.gz
  • Upload date:
  • Size: 9.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for geomstats-2.8.0.tar.gz
Algorithm Hash digest
SHA256 d34df1ed96354859f694dfea2f58080d34f6e82bb0a5e49061d49ec213ef48a0
MD5 8477bba6e3391898ea6b1285d6e31c3c
BLAKE2b-256 ccd9a99cd1b545d0ac3117bc6246e144755559a9a2fed734137db6ec214a083b

See more details on using hashes here.

File details

Details for the file geomstats-2.8.0-py3-none-any.whl.

File metadata

  • Download URL: geomstats-2.8.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for geomstats-2.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd167c944586cb822c4cd6466fd70fc0819f6eb9a8c0e3de4971de4033ff4276
MD5 b2c2e3176817ffada8603079bbc4ebb7
BLAKE2b-256 162eb8e0c53367d4a55338a4dd4e55cfcd560f5a5441f3906a106cee7cf9f1fb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page