public final class NearestNeighbors extends PrimitiveOp
Rows of points are assumed to be input points. Rows of centers are assumed to be the list of candidate centers. For each point, the k centers that have least L2 distance to it are computed.
operation
Modifier and Type | Method and Description |
---|---|
static NearestNeighbors |
create(Scope scope,
Operand<Float> points,
Operand<Float> centers,
Operand<Long> k)
Factory method to create a class wrapping a new NearestNeighbors operation.
|
Output<Float> |
nearestCenterDistances()
Matrix of shape (n, min(m, k)).
|
Output<Long> |
nearestCenterIndices()
Matrix of shape (n, min(m, k)).
|
equals, hashCode, op, toString
public static NearestNeighbors create(Scope scope, Operand<Float> points, Operand<Float> centers, Operand<Long> k)
scope
- current scopepoints
- Matrix of shape (n, d). Rows are assumed to be input points.centers
- Matrix of shape (m, d). Rows are assumed to be centers.k
- Number of nearest centers to return for each point. If k is larger than m, then
only m centers are returned.public Output<Long> nearestCenterIndices()
Copyright © 2022. All rights reserved.