Skip to content

IndicatorKriging

IndicatorKriging(
    variogram: Variogram,
    search: Search | Sequence[Search],
    threshold: float | str,
)

Ordinary kriging of the indicator value <= threshold; estimates are probabilities.

threshold is in the unit of the values, or text such as "1 g/t" converted to it at fit.

unit property

unit

Unit of the estimates: that of the fitted values, ratio for probabilities; None if unknown.

cross_validate

cross_validate(
    *, folds: int | None = None
) -> CrossValidation

Re-estimates every sample from the others, through the same search passes.

Parameters:

Name Type Description Default
folds int

Leave-one-out when None; otherwise k-fold, each sample estimated without the samples of its fold. Samples fitted with holes keep their holes whole: the j-th of the sorted hole ids goes to fold j % folds. An untagged sample i goes to fold i % folds, so without holes and with folds equal to the number of samples this is leave-one-out. Folds span all domains; each held-out sample is estimated in its own domain.

None

from_parquet classmethod

from_parquet(path)

Reads to_parquet output; predictions match the saved estimator's bit for bit.

Parameters:

Name Type Description Default
path str or PathLike
required

Raises:

Type Description
InvalidInput

If the file holds another class or a newer format.

predict

predict(
    targets,
    *,
    return_variance: bool = False,
    anisotropy=None,
    diagnostics: bool = False,
    domains=None,
    domain_column=None,
)

Estimates at targets; NaN where the search found too few samples.

Parameters:

Name Type Description Default
targets (array_like, PointSet or BlockModel)
required
return_variance bool

Also return the kriging variance.

False
anisotropy LocalAnisotropy

Orients each target's variogram and search.

None
diagnostics bool

Return a Table instead: value, variance, efficiency (kriging efficiency), slope (slope of regression), n_samples, pass (the search, from 1, that filled each target), n_holes (distinct holes among the samples used; untagged samples count one each), mean_distance (to the samples used), negative_weight_sum, lagrange (the Lagrange multiplier; 0 for simple kriging, NaN where undefined), max_samples_reached (1 where the search returned max_samples), n_other_domain (samples used from domains other than the target's), support_variance (the variance of the target's support, the sill for points and sill minus the mean variogram within the block for blocks, nugget excluded), estimate_variance (the variance of the estimator; the further below support_variance, the smoother the estimates) and target_met (1 where the samples used reach the search's target_slope or target_efficiency, 0 where even max_samples fall short, NaN without one). NaN where unestimated.

False
domains array_like or label

Domain label of each target, or one label for all of them; required when fitted with domains. Targets of a domain without samples stay NaN.

None
domain_column str

The column of targets holding their domains; instead of domains.

None

Returns:

Type Description
ndarray, tuple of ndarray or Table

Estimates in unit, variances in its square.

to_parquet

to_parquet(path) -> None

Writes the samples as Parquet columns and the parameters as JSON in the file metadata.

Parameters:

Name Type Description Default
path str or PathLike
required
with_search(search: Search | Sequence[Search])

A copy of the estimator, fitted samples included, with search in place of its searches.

Parameters:

Name Type Description Default
search Search or sequence of Search

One search, or passes: targets one leaves unestimated go to the next.

required

used in