fips.Gaussian#

class fips.Gaussian(levels, scale, *, within=None, metric='euclidean')[source]#

Bases: _Decay

A Gaussian correlation, \(\exp(-d^2 / (2 \ell^2))\) at a distance \(d\).

The limit of Matern as \(\nu \to \infty\): very smooth. On the Earth it takes metric="chordal" (with the great-circle distance it is not positive-definite).

Parameters:
Raises:

ValueError – As Exponential, and for metric="haversine".

Examples

>>> import pandas as pd
>>> from fips import Gaussian
>>> Gaussian("x", 1.0).correlation(pd.DataFrame({"x": [0.0, 1.0]})).round(4)
array([[1.    , 0.6065],
       [0.6065, 1.    ]])

Attributes

metric

How the distance is measured, "euclidean", "haversine" or "chordal".

scale

The length scale, a time for a datetime or timedelta level, else in the levels' units (km on the Earth).

within

The levels on which two labels must be the same to be correlated ("time.hour" is an attribute of a datetime level).

Methods

correlation(coords)

Return the correlation between the rows of coords, zero between groups (see CorrelationModel.correlation()).

Inherited

From CorrelationModel: levels, with_std