The embedding.neighbors
function type returns information about the nearest
neighbor rows in an existing embedding
dataset type to an arbitrary point.
A new function of type embedding.neighbors
named <id>
can be created as follows:
mldb.put("/v1/functions/"+<id>, {
"type": "embedding.neighbors",
"params": {
"defaultNumNeighbors": <int>,
"defaultMaxDistance": <float>,
"dataset": <SqlFromExpression>,
"columnName": <Path>
}
})
with the following key-value definitions for params
:
Field, Type, Default | Description |
---|---|
defaultNumNeighbors | Default number of neighbors to return. This can be overwritten when calling the function. |
defaultMaxDistance | Default value for |
dataset | Embedding dataset in which to find neighbors. This must be a dataset of type |
columnName | The column name within the embedding dataset to use to match values against. This must match the columns within the dataset referred to in the |
Functions of this type have the following input values:
coords
: name of row for which to find neighbors, or embedding representing the point in space for which to find neighborsnum_neighbours
: optional integer overriding the function's default value if specified max_distance
: optional double overriding the function's default value if specifiedFunctions of this type have the following output values:
* neighbors
: an embedding of the rowPaths of the nearest neighbors in order of proximity
* distances
: a row of rowName to distance for the nearest neighbors