fips.Matern#
- class fips.Matern(levels, scale, nu=1.5, *, within=None, metric='euclidean')[source]#
Bases:
_DecayA Matérn correlation, of smoothness \(\nu\).
\[C(d) = \frac{2^{1-\nu}}{\Gamma(\nu)} \, r^\nu K_\nu(r), \qquad r = \sqrt{2\nu} \, d / \ell,\]where \(K_\nu\) is the modified Bessel function of the second kind (Rasmussen and Williams 2006, eq. 4.14). \(\nu = 1/2\) is
Exponential, and \(\nu \to \infty\) isGaussian.- Parameters:
levels (
str|Sequence[str]) – The levels the distance is measured along (seeExponential).scale (
float|str|Timedelta) – The length scale \(\ell\), positive.nu (
float) – The smoothness \(\nu\), in (0, 50]: past that, useGaussian.within (
str|Sequence[str] |None) – Correlate only labels the same on these levels (seeExponential).metric (
str) – How the distance is measured (seeExponential);"haversine"only for \(\nu \le 1/2\) (positive-definite there).
- Raises:
ValueError – As
Exponential, and if nu is not in (0, 50].
Examples
>>> import pandas as pd >>> from fips import Matern >>> coords = pd.DataFrame({"x": [0.0, 1.0]}) >>> Matern("x", 1.0, nu=0.5).correlation(coords).round(4) array([[1. , 0.3679], [0.3679, 1. ]])
Attributes
How the distance is measured, |
|
The smoothness, 1/2 for the exponential and smoother as it grows. |
|
The length scale, a time for a datetime or timedelta level, else in the levels' units (km on the Earth). |
|
The levels on which two labels must be the same to be correlated ( |
Methods
|
Return the correlation between the rows of coords, zero between groups (see |
Inherited
From CorrelationModel: levels, with_std