geoml.kernels
Covariance functions. A kernel is handed to a GP node together with a transform, which is what carries the ranges and the anisotropy: the kernel says how correlation falls with distance, and the transform says what distance means.
- class geoml.kernels.Gaussian[source]
Bases:
_KernelGaussian kernel.
exp(-3 d**2)of the distance measured in ranges, so the correlation falls to 5% at one range. Infinitely differentiable: the smoothest field of the kernels here, and the one for gently varying quantities and structural surfaces.
- class geoml.kernels.Spherical(epsilon=1e-12)[source]
Bases:
_KernelSpherical kernel.
The geostatistical classic,
1 - 1.5 d + 0.5 d**3of the distance in ranges and zero past one range. Continuous but not differentiable at the origin, so the field is rough at short scale, as a grade usually is.
- class geoml.kernels.Exponential(epsilon=1e-12)[source]
Bases:
_KernelExponential kernel.
exp(-3 d)of the distance in ranges, falling to 5% at one range. The roughest of the kernels here: continuous, never differentiable.
- class geoml.kernels.Cubic[source]
Bases:
_KernelCubic kernel.
A polynomial in the distance in ranges that reaches zero at one range and stays there, as the spherical does, while staying smooth at the origin: a compactly supported stand-in for the Gaussian.
- class geoml.kernels.Constant[source]
Bases:
_KernelConstant kernel.
One at every distance: a field that takes one value everywhere. Its matrix has rank one, so it is no kernel for a GP node, whose bias does the same; it is kept for covariances built by hand.
- class geoml.kernels.Linear(transform=None)[source]
Bases:
_AbstractCovarianceThe linear covariance, the dot product of transformed coordinates.
A field that is a linear function of the coordinates, as seen through the transform: a trend, with the transform’s parameters as its slopes. Meant as a term in a Sum of covariances.
- __init__(transform=None)[source]
- Parameters:
transform (_Transform | None) – An object from the transform module; the identity if left out.
- point_variance(x)[source]
Computes the data points’ self variance (covariance between the point and itself).
- class geoml.kernels.Cosine[source]
Bases:
_KernelCosine kernel.
cos(2 pi d)of the distance in ranges: a field repeating with a period of one range. A valid covariance along one axis only – in two or three dimensions a cosine of the distance is not, and the inducing points’ Cholesky can fail on it – so it is no kernel for a GP node.
- class geoml.kernels.Sum(*args)[source]
Bases:
_NodeCovarianceA weighted sum of covariances, the weights trained and summing to one.
Nested structures, as a variogram model has them: a short range and a long one, or a trend and a residual. The weights share the one unit of variance between the terms.
- class geoml.kernels.Product(*args)[source]
Bases:
_NodeCovarianceThe product of covariances.
Correlated only where every factor is: a periodic covariance times a decaying one gives a pattern that repeats and fades, and covariances of different coordinates multiply into one over all of them.
- covariance_matrix_d1(x, y, dir_y)[source]
Computes point-direction covariance matrix between x and y tensors.
- class geoml.kernels.Matern32[source]
Bases:
_KernelOnce differentiable Matérn kernel.
(1 + 5 d) exp(-5 d)of the distance in ranges: rougher than the Gaussian and smoother than the exponential, the usual middle ground for a physical quantity.
- class geoml.kernels.Matern52[source]
Bases:
_KernelTwice differentiable Matérn kernel.
(1 + 6 d + 12 d**2) exp(-6 d)of the distance in ranges: one step smoother than Matern32, still short of the Gaussian’s perfect smoothness.
- class geoml.kernels.RationalQuadratic(scale=1)[source]
Bases:
_KernelRational quadratic (a.k.a. Cauchy) kernel.
(1 + 3 d**2 / scale) ** -scaleof the distance in ranges: a mixture of Gaussian kernels over many ranges, which gives a long tail of weak correlation. scale is trained; the larger it grows, the closer the kernel comes to the Gaussian.
- class geoml.kernels.Covariance(kernel, transform=None)[source]
Bases:
_AbstractCovarianceCovariance function.
- __init__(kernel, transform=None)[source]
Initializer for Covariance.
- Parameters:
kernel (_Kernel) – A kernel object.
transform (_Transform | None) – An object from the transform module; the identity if left out.
- point_variance(x)[source]
Computes the data points’ self variance (covariance between the point and itself).
- covariance_matrix_d1(x, y, dir_y)[source]
Computes point-direction covariance matrix between x and y tensors.
- covariance_matrix_d2(x, y, dir_x, dir_y)[source]
Computes direction-direction covariance matrix between x and y tensors.
- class geoml.kernels.Scale(base_covariance)[source]
Bases:
_WrapperCovarianceKernel scaling.
Add a parameter allowing for non-unit variance.
- point_variance(x)[source]
Computes the data points’ self variance (covariance between the point and itself).
- covariance_matrix_d1(x, y, dir_y)[source]
Computes point-direction covariance matrix between x and y tensors.