KNN
K-Nearest Neighbors (KNN) is an estimation algorithm where every point is given the average value of the 'k' closest data points.
Parameters
source
(geoscience object reference)- A geoscience object reference that points to a one-dimensional continuous attribute inside a pointset or downhole-intervals object. This is your input data.
target
(geoscience object reference)- A geoscience object reference that tells the task where to save the result. It must point to an attribute inside a pointset, downhole-intervals, regular-3d-grid, or regular-masked-3d-grid object.
search_neighborhood
(object)- A search ellipse that the task will use to find each point's nearest neighbors.
-
{
"max-samples": 40, // The neighborhood can find up to this many other points.
"anisotropy": {
"ellipsoid_ranges": {
"major": 70, // The ellipsoid's major axis length.
"semi_major": 70, // The ellipsoid's semi-major axis length.
"minor": 5, // The ellipsoid's minor axis length.
},
"rotation": {
"dip_azimuth": 0, // The azimuth of the ellipsoid's dip direction, in degrees.
"dip": 0, // The dip of the ellipsoid, in degrees.
"pitch": 0, // The pitch of the ellipsoid, in degrees.
},
},
}
Example
Request
requests.post(
"https://{hub}.api.seequent.com/compute/orgs/{org_id}/geostat/knn",
headers={"Authorization": "Bearer {token}"},
json={
"parameters": {
"composites": {
"type": "geoscience-object-reference",
"object_reference": "https://{hub}.api.seequent.com/geoscience-object/orgs/{org_id}/workspaces/{workspace_id}/objects/path/my-pointset.json",
"object_element": [
{
"type": "element",
"path": "/locations/attributes/@name=my-data",
},
],
},
"target": {
"type": "geoscience-object-reference",
"object_reference": "https://{hub}.api.seequent.com/geoscience-object/orgs/{org_id}/workspaces/{workspace_id}/objects/path/my-pointset.json",
"object_element": [
{
"type": "element",
"path": "/locations/attributes/@name=my-knn",
},
],
},
"neighborhood": {
"max-samples": 40,
"anisotropy": {
"ellipsoid_ranges": {
"major": 25,
"semi_major": 25,
"minor": 25,
},
"rotation": {
"dip_azimuth": 0,
"dip": 0,
"pitch": 0,
},
},
},
},
},
)
Result
{
"message": "KNN estimate completed.",
"object_modified": {
"type": "geoscience-object-reference",
"object_reference": "https://{hub}.api.seequent.com/geoscience-object/orgs/{org_id}/workspaces/{workspace_id}/objects/path/my-pointset.json",
"object_element": [
{
"type": "element",
"path": "/locations/attributes/@name=my-knn",
},
],
},
}
Tips
- The source and target can use the same object, but they don't have to.