Ordinary kriging answers one question. At a place you did not sample, it returns the linear unbiased estimate of the measured variable, and the error variance of that estimate, from a single variogram. Soil metals, ore grade, and contaminant concentrations often ask a different question. A probability of exceeding a cutoff. A grade in a volume, where continuity along a borehole is shorter than continuity between boreholes. A probability that can use a cheap, uncertain proxy where the expensive assay is missing. A nonlinear function of each assay. The part of a map that lives at one spatial scale.
This notebook is the map for those five estimators in GeoLattice. It writes the change each one makes to the ordinary-kriging system, then runs all five on eighteen samples and one target. The five notebooks that follow keep one estimator each and carry it through a survey.
Six notebooks change the ordinary-kriging system so it can return a probability, a block grade, a soft assay, a skewed histogram, or one scale of a nested variogram.
Specialized Kriging. This notebook. All five estimators on eighteen samples and one target.
Indicator Kriging. Meuse zinc. A cutoff variogram, a Brier score, and an E-type map.
3-D Kriging (KT3D). GSLIB cluster.dat, then synthetic boreholes. Anisotropy, octant search, block support, and a depth trend.
Soft Kriging. Jura cadmium, with zinc as a dense proxy and most cadmium assays held out.
\(\mathbf{C}\) holds covariances among the samples, \(\mathbf{c}_0\) holds covariances between the samples and the target, and \(\mu\) enforces \(\sum \lambda_i = 1\) so an unknown constant mean cancels. The kriging variance is \(C(0) - \boldsymbol{\lambda}^{\top}\mathbf{c}_0 - \mu\).
The five estimators in this chapter keep a system of that shape. Each one changes the rows that enter \(\mathbf{C}\), the right-hand side \(\mathbf{c}_0\), or the numbers the weights multiply.
Estimator
Weights multiply
Right-hand side
What comes back
Indicator kriging
\(0/1\) indicators at a cutoff
The indicator covariance
\(P[Z(\mathbf{x}_0) \ge z_k]\), clipped to \([0, 1]\)
3-D kriging (kt3d)
The grade, at \((x, y, z)\)
Covariance along an anisotropy ellipsoid
A grade, a variance, and optionally a block average
Soft kriging
Hard indicators and soft probabilities
The hard covariance, rescaled by one coefficient \(B\)
A probability that uses both data types
Disjunctive kriging
Hermite polynomials of the normal score
\(\rho(h)^n\) at Hermite order \(n\)
A nonlinear grade, and any cutoff probability from the same fit
Factorial kriging
The grade
Covariance of one nested structure, with \(\sum \lambda_i = 0\)
That scale alone: short-range, long-range, or the nugget
Ordinary kriging of the raw grade remains the reference. The worked example below reports it beside the five calls, from a spherical variogram that is set rather than fitted, the same device as the kriging introduction.
Indicator kriging
For a cutoff \(z_k\), code each sample as an exceedance indicator
The expectation of that indicator is the exceedance probability, \(\mathbb{E}[I(\mathbf{x}_0; z_k)] = P[Z(\mathbf{x}_0) \ge z_k]\). Ordinary kriging of the \(0/1\) values is therefore a direct estimate of the probability. IndicatorKriging solves the ordinary-kriging system with the indicator covariance \(C_I\) and clips the result to \([0, 1]\).
Each cutoff has its own variogram. The theoretical sill of a binary indicator is \(p_k(1-p_k)\), where \(p_k = P[Z \ge z_k]\). A high-grade streak can be shorter, or more nuggety, than the mid-grade background, so each probability map keeps its own variogram.
A stack of cutoffs \(z_1 < \cdots < z_K\) is a discrete conditional distribution. Its mean is the E-type estimate,
evaluated by trapezoid rule in compute_etype_from_probabilities. Nothing in the separate kriging systems forces the probabilities to decrease as the cutoff rises. The indicator notebook is where that order relation, the per-cutoff variogram, and the E-type map are checked on Meuse zinc.
IndicatorKriging is two-dimensional and pointwise. The class stores the samples in fit and takes the cutoffs, with an optional dict of (nugget, partial sill, range) per cutoff, in predict.
Kriging in three dimensions
kt3d is a Python port of GSLIB’s kt3d (Deutsch & Journel, 1998). The predictor is still a weighted sum of nearby grades. The distance that enters the covariance is the anisotropic distance
where \(R\) rotates \(\mathbf{d}\) onto the axes of an ellipsoid and rescales those axes by the major, minor-horizontal, and vertical ranges. A transformed distance of 1 is one range in every direction. For borehole data the vertical range is the short one: grade can change quickly with depth and stay smooth between holes.
ktype selects the mean model. 'ordinary' is the unknown constant mean above. 'simple' uses a known mean. A polynomial drift in \(x\), \(y\), \(z\), and their products is kriging with a trend. 'external_drift' ties the mean to a secondary variable known at the samples and at the target. 'locally_varying_mean' plugs in a known local mean and kriges the residual as in simple kriging.
Two further controls matter once the data are a volume. The search is an ellipsoid (search_radius, search_radius2, search_radius3) with a minimum and a maximum number of neighbours, and an optional cap of noct neighbours per octant so one cluster of holes cannot fill the whole neighbourhood. Block kriging replaces each point-to-target covariance with the average covariance between the sample and a grid of points inside the block. Averaging over a volume smooths the estimate and lowers the kriging variance. That support effect is worked in the 3-D notebook, on synthetic boreholes. The call here is ordinary point kriging, so the only change from the map-view system is the third coordinate and the vertical range.
Soft kriging
Indicator kriging treats every sample as exact: the indicator is 0 or 1. A certified assay often is exact and sparse, while a cheaper proxy, a portable sensor, a geophysical grid, another metal measured at the same campaign, is dense and only correlated with the cutoff. Soft data are probabilities \(F(\mathbf{u}) \in [0, 1]\), an estimate of \(P[Z(\mathbf{u}) \ge z]\) at locations that may have no assay.
A full cokriging of the hard indicator \(I\) and the soft probability \(F\) needs a cross-variogram. The Markov-Bayes model of Zhu & Journel (1993) replaces that cross-variogram with one calibration coefficient
\[
B = \frac{\mathrm{Cov}(I, F)}{\mathrm{Var}(F)},
\]
estimated from co-located pairs by markov_bayes_calibrate. Under the Markov screening assumption the covariances collapse to rescalings of the hard-indicator covariance \(C_H\):
\(B\) near 1 means the proxy carries almost as much information as an assay. \(B\) near 0 means the soft rows drop out, and the estimator falls back to ordinary indicator kriging of the hard data. SoftKriging then solves one ordinary-kriging system whose weights cover both data types:
The estimate is clipped to \([0, 1]\). When the proxy is a continuous measurement, fit_soft_probability_model turns it into \(F\) with a logistic regression fitted on the hard indicators. The soft-kriging notebook does that calibration on Jura zinc against a cadmium cutoff of 1 mg/kg. The example below sets \(B\) and a fixed logistic, so the weights are the solution of a known system.
Disjunctive kriging
Ordinary kriging is the best predictor inside the class of linear combinations of the data. The best predictor without that restriction is the conditional expectation \(\mathbb{E}[Z(\mathbf{x}_0) \mid \text{data}]\), which needs the full multivariate distribution. Disjunctive kriging (Matheron, 1976) sits between the two. It is the best predictor of the form
a separate function of each sample, under one model that makes those functions computable.
The model has two steps. A Gaussian anamorphosis writes \(Z(\mathbf{x}) = \varphi\bigl(Y(\mathbf{x})\bigr)\) with \(Y\) standard normal, the same normal-score transform nscore uses for sequential Gaussian simulation. The anamorphosis is expanded in orthonormal Hermite polynomials,
The spatial assumption is the bi-Gaussian model: every pair \(\bigl(Y(\mathbf{x}), Y(\mathbf{x}')\bigr)\) is bivariate normal with correlation \(\rho(h)\). Hermite polynomials then diagonalize the covariance,
Order \(n = 0\) is the mean. The orders \(n \ge 2\) are the nonlinear part. The same kriged components estimate a cutoff probability, with indicator coefficients \(\chi_n(y_c)\) in place of \(\varphi_n\). predict returns the grade. predict_proba returns the probabilities. Both come from one fit.
DisjunctiveKriging fits the variogram of \(Y\) itself. On a short sample that fit can differ from the variogram you would write down for \(Z\), and the truncated Hermite series can account for slightly more or slightly less than \(\mathrm{Var}(Z)\). The attribute explained_variance_ratio_ is that fraction. The disjunctive notebook is where the anamorphosis, the truncation, and a comparison with ordinary kriging are examined on Jura cadmium. The call below uses six Hermite orders so the shape of the estimator is visible on eighteen points.
Factorial kriging
A fitted variogram is usually nested: a nugget plus two or more bounded structures, each with its own range. Ordinary kriging uses the sum. Factorial kriging (Matheron, 1982) treats the structures as mutually uncorrelated zero-mean factors,
To estimate one factor \(Z_v(\mathbf{x}_0)\), the left-hand side stays the ordinary-kriging matrix of the full covariance \(C = \sum_u C_u\). The right-hand side changes to the covariance of structure \(v\) alone, and the unbiasedness constraint changes from 1 to 0, because a zero-mean factor has mean zero and the unknown \(m\) has to be filtered out:
\(Z\) with the nugget removed from the target covariance
'nugget' or 0
\(\sum \lambda_i = 0\)
The nugget component
an integer \(k \ge 1\)
\(\sum \lambda_i = 0\)
Structure \(k\) alone
a sequence of integers
\(\sum \lambda_i = 0\)
The sum of those structures
Because the system is linear in the right-hand side, structures that share the constraint \(\sum \lambda_i = 0\) add: extract([1, 2]) equals extract(1) + extract(2). The sum of every factor, each extracted on its own, reconstructs the ordinary-kriging estimate minus the local mean that those sum-to-zero systems removed. When the target is a sample location, 'total' reproduces the sample and 'denoised' pulls the nugget spike off it. Away from every sample the nugget covariance is zero, so 'denoised' and 'total' agree. The factorial notebook fits the nested model on Jura cadmium and checks this arithmetic on the grid. The example below passes the nested model in, as a known decomposition of the variance of \(Z\).
Specialized kriging in GeoLattice
Object
Call
IndicatorKriging
fit(coords, values) then predict(coords_pred, thresholds, variogram_params)
compute_etype_from_probabilities
Trapezoid mean of a stack of exceedance probabilities
kt3d
A data frame, a variogram dict, and the points to estimate. ktype selects the mean
SoftKriging
fit(hard_coords, hard_indicator, soft_coords, soft_prob, B=...) then predict(..., sill, range_, nugget)
The coefficient \(B\), and a logistic map from a continuous proxy to \(F\)
DisjunctiveKriging
fit(coords, values) then predict and predict_proba
FactorialKriging
fit(coords, values) then extract(coords_pred, factor=...)
use_gpu=False in the example keeps the arithmetic on NumPy. The five case-study notebooks time the batched k-nearest-neighbour solve on CPU and GPU.
Python setup
Installation. This notebook needs installation option 4 (core, spatial analysis, spatial statistics and geostatistics): pip install "geolattice[geostats]". See “Installation options” in the GeoLattice README.
Code
%matplotlib inlineimport osos.environ.setdefault("TF_CPP_MIN_LOG_LEVEL", "3")import sysimport warningssys.modules.setdefault("tensorflow", None)warnings.filterwarnings("ignore", category=UserWarning)import numpy as npimport pandas as pdimport matplotlib.pyplot as pltfrom scipy.spatial.distance import cdistimport geolattice.geostatistics as gstatfrom geolattice.geostatistics import ( Variogram, OrdinaryKriging, IndicatorKriging, DisjunctiveKriging, FactorialKriging, SoftKriging, kt3d,)USE_GPU =False# identical arithmetic on CPU and GPU machinesprint(f"geolattice.geostatistics : {gstat.__version__}")
geolattice.geostatistics : 0.3.49
Eighteen samples and one target
Eighteen measurements of a metal grade, and one unsampled target at \((0.46,\ 0.38)\). The samples were built from
\[
z = 1.15 + 4.20 \, x - 0.55 \, \mathrm{depth} + 6.50 \exp\!\left(-\frac{(x-0.30)^2 + (y-0.50)^2}{2 \cdot 0.08^2}\right)
\]
and rounded to two decimals. The term in \(x\) is a long-range rise toward the east. The Gaussian bump is a short-range hotspot centred on P8, at \((0.30,\ 0.50)\), where the grade reaches \(8.64\). Depth pulls the grade down. Six of the eighteen samples meet or exceed the cutoff \(3.5\), so the marginal exceedance rate is \(1/3\).
The target’s depth in the 3-D call is \(0.40\). On the generating surface that depth gives \(3.148\). The two samples closest in map view are P4 (\(2.44\)) and P9 (\(3.18\)), both \(0.063\) away, and both much deeper than \(0.40\) (depths \(1.4\) and \(1.6\)). P8, the hotspot, is \(0.20\) away in the map and only \(0.10\) away in depth.
A proxy \(0.40\, z + 0.35\, x + 0.15\) stands in for a cheap sensor. For soft kriging, six assays are treated as hard: P1, P2, P7, P13, P14, and P18. Every one of them falls below \(3.5\). The other twelve locations, including P8, keep only the proxy. That split is the situation soft kriging is for: the laboratory samples you have are all non-exceedances, and the evidence of a high grade sits in the proxy.
The covariances used below are set, except for the normal-score variogram inside DisjunctiveKriging, which the class fits itself.
Predictor
Covariance used here
Ordinary kriging, and kt3d in map view
Spherical, nugget \(0.15\), partial sill \(\mathrm{Var}(z) - 0.15\), range \(0.70\)
kt3d at depth \(0.40\)
The same sill, horizontal ranges \(0.70\), vertical range \(0.40\)
The map-view covariances are the spherical models in the table above. DisjunctiveKriging is the exception: it fits the variogram of the normal scores during fit. Factorial kriging is told the nested split, \(35\%\) of the structured variance at range \(0.22\) and \(65\%\) at range \(0.85\), on top of a nugget of \(0.20\).
Soft probabilities come from a fixed logistic of the proxy,
and the Markov-Bayes coefficient is set to \(B = 0.70\). A sample of indicators that are all zero has \(\mathrm{Cov}(I, F) = 0\), so \(B\) is not identified from these six hard assays. The soft-kriging notebook estimates \(B\) from a mixed set of exceedances and non-exceedances. Here the coefficient is an input, and the comparison is hard-only indicator kriging of those six assays against the combined system.
Six nearest in map view
point z depth map h_3d I
P4 2.44 1.4 0.063 2.502 0
P9 3.18 1.6 0.063 3.001 0
P8 8.64 0.5 0.200 0.380 1
P10 3.49 0.2 0.216 0.588 0
P3 2.29 0.6 0.228 0.597 0
P5 3.53 0.4 0.241 0.344 1
Six nearest in the 3-D anisotropy metric (a value of 1 is one range)
point z depth map h_3d I
P5 3.53 0.4 0.241 0.344 1
P8 8.64 0.5 0.200 0.380 1
P15 3.13 0.4 0.286 0.409 0
P10 3.49 0.2 0.216 0.588 0
P3 2.29 0.6 0.228 0.597 0
P1 1.41 0.3 0.422 0.653 0
predictor value second
formula, depth 0.40 3.148
ordinary kriging 3.033 SE 0.746
kt3d, map view 3.036 SE 0.747
kt3d, depth 0.40 4.651 SE 1.228
disjunctive kriging 2.666 SE 1.039
factorial total 2.794
indicator P(Z>=3.5) 0.056 at P8 1.000
hard-only indicator 0.000
soft kriging, B=0.70 0.459
disjunctive P(Z>=3.5) 0.205 Y range 0.300
DK explained variance ratio 0.932
Y variogram nugget 0.000 partial sill 0.899 range 0.300
Factorial factors
total short long denoised nugget short_and_long
target 2.794 -0.523 0.490 2.794 0.000 -0.033
P8 8.640 3.275 1.761 7.863 0.777 5.036
additivity at the target: extract([1, 2]) = -0.032827 extract(1)+extract(2) = -0.032827
How to read the five answers
The formula at depth \(0.40\) is \(3.148\). Ordinary kriging of the grade returns \(3.033\), with standard error \(0.746\). The two nearest samples in the map, P4 and P9, are \(0.063\) away and carry grades \(2.44\) and \(3.18\), so a linear average of neighbours lands just under \(3.1\). Map-view kt3d returns \(3.036\) and standard error \(0.747\). It is the same spherical model, using the twelve nearest samples. The two calls agree.
Indicator kriging answers a different question. \(P[Z \ge 3.5]\) at the target is \(0.056\), against a marginal rate of \(0.333\). Six samples exceed \(3.5\), and three of the eight nearest in the map do, but the two closest indicators are \(0\). Those two dominate the indicator system. At P8, where the sample itself is \(8.64\), the same cutoff returns a probability of \(1\). A cutoff probability follows the local indicators: near \(0\) beside non-exceedances, and near \(1\) on the hotspot.
3-D kriging uses the same grades and a vertical range of \(0.40\). At depth \(0.40\) the estimate is \(4.651\), with standard error \(1.228\). The anisotropy metric rescales depth by \(1/0.40\) and the map coordinates by \(1/0.70\), so a value of \(1\) is one range. In that metric P4 and P9, the map-view neighbours, sit at distances \(2.50\) and \(3.00\). Almost all of that distance is depth, past one vertical range, so their covariance with the target is zero. The nearest samples are then P5 (grade \(3.53\), the same depth as the target, anisotropic distance \(0.344\)) and P8 (grade \(8.64\), anisotropic distance \(0.380\)). The hotspot is inside the neighbourhood, and the estimate rises from about \(3.0\) to \(4.65\). The standard error stays large because that neighbourhood is thin. Two samples a short step apart on the map, and a long step apart in depth, are different neighbours once the vertical range is the short one.
Soft kriging uses only the six hard assays. All six fall below \(3.5\), their indicators are all \(0\), and ordinary kriging of a constant \(0\) with weights summing to \(1\) returns \(0\). With \(B = 0.70\) the combined system returns \(0.459\). The soft probabilities at the nearby proxy locations, including a value near \(1\) at P8, are what produce that probability. \(B\) was set, because six non-exceedances cannot identify it. The soft-kriging notebook estimates \(B\) from co-located pairs that do contain both indicators.
Disjunctive kriging returns a grade of \(2.666\) and standard error \(1.039\), and from the same Hermite components a probability \(P[Z \ge 3.5] = 0.205\). Six orders capture \(0.932\) of the variance of \(Z\). The normal-score variogram fitted inside the class has nugget \(0\), partial sill \(0.899\), and range \(0.300\), shorter than the range \(0.70\) used for the raw grade. The grade \(2.666\) and the probability \(0.205\) sit on that fitted covariance of \(Y\). The indicator probability \(0.056\) sits on the indicator model in the table above. The call shows the shape of the estimator: one fit, a nonlinear grade, and a cutoff probability that reuses the kriged Hermite terms. The disjunctive notebook is where that fitted variogram is judged against ordinary kriging on a real histogram.
Factorial kriging at the target returns a total of \(2.794\). The short-range factor is \(-0.523\) and the long-range factor is \(+0.490\). They cancel to \(-0.033\), and extract([1, 2]) matches extract(1) + extract(2) to machine precision. The nugget factor at the target is \(0\), and the denoised estimate equals the total, \(2.794\): no sample sits on the target, so the nugget covariance on the right-hand side is zero. At P8 the total reproduces the sample, \(8.640\). The denoised value is \(7.863\). The nugget factor is \(0.777\), the short-range factor is \(3.275\), and the long-range factor is \(1.761\). Those three sum to \(5.813\). The gap up to \(8.640\) is the local mean that the sum-to-zero constraint removed from each factor. The spike at P8 is carried mostly by the short-range structure. That separation is the reason for fitting a nested variogram in the first place.
Where the next notebooks go
The calls above are the five estimators with the covariances either set or, for disjunctive kriging, fitted on eighteen points. What they leave out is a real sampling pattern, a held-out check, and the bookkeeping each method needs before the map is worth trusting.
Nine zinc quantiles on the Meuse floodplain, a spherical fit at each cutoff, a Brier score against the marginal frequency, probability maps, and an E-type mean
The GSLIB cluster.dat benchmark, then borehole grade on a grid: the search ellipsoid, octant search, a depth trend, and point kriging against block kriging
A 20% / 80% split of Jura cadmium, a logistic probability from zinc, a calibrated \(B\), and held-out AUC and Brier scores against hard-only indicator kriging
A fitted nugget + short + long model of Jura cadmium, maps of each factor, a check that same-constraint factors add, and a denoised grade map
Open the notebook whose question matches the table at the top. Each one assumes the ordinary-kriging system from the classic-kriging chapter and the one-paragraph version of its own estimator written here.
ik3d and kt3d, the reference programs for indicator kriging and 3-D kriging
Zhu, H. & Journel, A.G. (1993). Formatting and integrating soft data: stochastic imaging via the Markov-Bayes algorithm. In Geostatistics Tróia ’92, 1-12.
Soft kriging
Matheron, G. (1976). A simple substitute for conditional expectation: the disjunctive kriging. In Advanced Geostatistics in the Mining Industry, 221-236. Reidel.
Disjunctive kriging
Rivoirard, J. (1994). Introduction to Disjunctive Kriging and Nonlinear Geostatistics. Oxford.
The Hermite-polynomial form used by DisjunctiveKriging
Matheron, G. (1982). Pour une analyse krigeante des données régionalisées. Note N-732, Centre de Géostatistique, Fontainebleau.
Factorial kriging
Sandjivy, L. (1984). The factorial kriging analysis of regionalized data. In Geostatistics for Natural Resources Characterization. Reidel.
Factorial kriging in geochemical mapping
Textbooks that cover more than one of them
Reference
What to read it for
Goovaerts, P. (1997). Geostatistics for Natural Resources Evaluation. Oxford.
Indicator coding, soft data, disjunctive kriging, factorial kriging, and the Jura survey