geomstats.distributions package#


geomstats.distributions.brownian_motion module#

Brownian motion defined on a manifold.

class geomstats.distributions.brownian_motion.BrownianMotion(space)[source]#

Bases: object

Class to generate a realization of Brownian motion on a manifold.


space (Manifold) – Manifold to generate Brownian motion on.


>>> import os
>>> os.environ["GEOMSTATS_BACKEND"] = "pytorch"
>>> import geomstats.backend as gs
>>> from geomstats.geometry.euclidean import Euclidean
>>> from geomstats.distributions.brownian_motion import BrownianMotion
>>> manifold = Euclidean(dim=3)
>>> euclidean_brownian_motion = BrownianMotion(manifold)
>>> sample_path = euclidean_brownian_motion.sample_path(
        initial_point=gs.array([0.0, 0.0, 0.0])



Elton P. Hsu, “Stochastic Analysis On Manifolds”, American Mathematical Soc. (2002): 71-99.

sample_path(end_time, n_steps, initial_point)[source]#

Generate a sample path of Brownian motion.

  • end_time (float) – Final time of the path.

  • n_steps (int) – Number of steps in the path.

  • initial_point (array-like, shape=[…, dim]) – Initial point of the path at time 0.


path (array-like, shape=[…, n_steps, dim]) – Sample path of Brownian motion.

geomstats.distributions.lognormal module#

LogNormal Distribution.

class geomstats.distributions.lognormal.LogNormal(space, mean, cov=None)[source]#

Bases: object

LogNormal Distribution on manifold of SPD Matrices and Euclidean Spaces.

  1. For Euclidean Spaces, if X is distributed as Normal(mean, cov), then

exp(X) is distributed as LogNormal(mean, cov).

  1. For SPDMatrices, there are different distributions based on metric

    a) LogEuclidean Metric : With this metric, LogNormal distribution is defined by transforming the mean – an SPD matrix – into a symmetric matrix through the Matrix logarithm, which gives the element “log-mean” that now belongs to a vector space. This log-mean and given cov are used to parametrize a Normal Distribution.

    b) AffineInvariant Metric : X is distributed as LogNormal(mean, cov) if exp(mean^{1/2}.X.mean^{1/2}) is distributed as Normal(0, cov)

  • space (Manifold obj, {Euclidean(n), SPDMatrices(n)}) – Manifold to sample over. Manifold should be instance of Euclidean or SPDMatrices.

  • mean (array-like, shape=[dim] if space is Euclidean Space, shape=[n, n] if space is SPD Manifold) – Mean of the distribution.

  • cov (array-like, shape=[dim, dim] if space is Euclidean Space, shape=[n*(n+1)/2, n*(n+1)/2] if space is SPD Manifold) – Covariance of the distribution.


>>> import geomstats.backend as gs
>>> from geomstats.geometry.spd_matrices import SPDMatrices
>>> from geomstats.distributions.lognormal import LogNormal
>>> mean = 2 * gs.eye(3)
>>> cov  = gs.eye(6)
>>> SPDManifold = SPDMatrices(3, metric=SPDAffineMetric(3))
>>> LogNormalSampler = LogNormal(SPDManifold, mean, cov)
>>> data = LogNormalSampler.sample(5)



A. Schwartzman, “LogNormal distributions and” “Geometric Averages of Symmetric Positive Definite Matrices.”, International Statistical Review 84.3 (2016): 456-486.

class geomstats.distributions.lognormal.LogNormalEuclidean(space, mean, cov)[source]#

Bases: object

LogNormal Distribution on Euclidean Space.


Generate samples for Euclidean Manifold.

class geomstats.distributions.lognormal.LogNormalSPD(space, mean, cov)[source]#

Bases: object

LogNormal Distribution on manifold of SPD Matrices.


Generate samples for SPD manifold.

samples_sym(mean_vec, cov, n_samples)[source]#

Generate symmetric matrices.

Module contents#