Skip to content

Nearest Neighbor🍋

NearestNeighbor 🍋

Bases: Entity

Nearest Neighbor Solver class.

Parameters:

Name Type Description Default
metric Metric

Metric used for neighbor selection. Reported distance is Euclidean.

required
axes list[Coord]

If solver is 2D or 3D. Defaults to [Coord.U, Coord.V, Coord.W].

[U, V, W]
backend GeostatsBackend

Computational backend to use. Default to RUST.

RUST

Attributes:

Name Type Description
metric Metric

Metric used for distance computation.

axes list[Coord]

If solver is 2D or 3D.

axes property 🍋

Return Solver Axis.

Returns:

Type Description
list[Coord]

List of axes.

backend property 🍋

Return the computational backend.

metric property 🍋

Return Solver Metric.

Returns:

Type Description
Metric

Solver Metric.

solve(obj, obj_region, obj_attribute, support, support_region, support_attribute) 🍋

Solve NearestNeighbor on a support using a conditioning object.

Parameters:

Name Type Description Default
obj GeoRefObject

Conditioning Object.

required
obj_region str | None

Spatial subset of conditioning.

required
obj_attribute str

Property to estimate.

required
support GeoRefObject

Object to estimate onto.

required
support_region str | None

Spatial subset of estimation.

required
support_attribute str

Property name to add in support.

required

solve_api(metric, dim, obj_coords, obj_data, support_coords, backend=GeostatsBackend.RUST, search_tree=SearchTrees.OCTREE) staticmethod 🍋

Low-level NearestNeighbor solving method.

Parameters:

Name Type Description Default
metric Metric

Metric used for neighbor selection.

required
dim int

Number of dimensions.

required
obj_coords ndarray

Conditioning object coordinates in region along specified axes.

required
obj_data ndarray

Values in selected region.

required
support_coords ndarray

Support coordinates in region along specified axes.

required
backend GeostatsBackend

Computational backend to use. Default to RUST.

RUST
search_tree SearchTrees

Spatial index used by the Rust backend.

OCTREE

Returns:

Type Description
tuple[ndarray, ndarray]

NearestNeighbor results and distance ndarrays.