evo.compute.tasks.geostatistics.knn.KNNParameters
Parameters for the KNN (K-nearest neighbour) estimation task.
Estimates values at target locations by computing the arithmetic mean of accepted neighbours found within the search ellipsoid.
Example::
>>> from evo.compute.tasks.common import Filter, FilterCondition, Source, Target
>>> from evo.compute.tasks.geostatistics.knn import KNNParameters
>>>
>>> params = KNNParameters(
... source=Source(object=pointset, attribute="locations.attributes[?name=='grade']"),
... target=Target.new_attribute(grid, "knn_grade"),
... neighborhood=SearchNeighborhood(
... ellipsoid=Ellipsoid(ranges=EllipsoidRanges(200, 150, 100)),
... max_samples=20,
... ),
... )
>>>
>>> # With a target filter to restrict estimation to specific categories on the target:
>>> params_filtered = KNNParameters(
... source=Source(object=pointset, attribute="locations.attributes[?name=='grade']"),
... target=Target.new_attribute(grid, "knn_grade"),
... neighborhood=SearchNeighborhood(...),
... target_filter=Filter(
... where=FilterCondition(
... attribute=grid.attributes["domain"],
... operator="in",
... values=["LMS1", "LMS2"],
... ),
... ),
... )
source
source: AnySourceAttribute
Source object and attribute containing the known values.
target
target: AnyTargetAttribute
Target object and attribute to create or update with KNN estimates.
neighborhood
neighborhood: SearchNeighborhood
Search neighbourhood defining which nearby samples to include.
source_filter
source_filter: Filter | None = Field(None, exclude=True)
Optional filter to restrict estimation to a subset of the source data.
Excluded from top-level serialisation (exclude=True) and injected as
source["filter"] by the custom serialiser.
target_filter
target_filter: Filter | None = Field(None, exclude=True)
Optional filter to restrict estimation to a subset of the target object.
Excluded from top-level serialisation (exclude=True) and injected as
target["filter"] by the custom serialiser.