L - Label type.public abstract class KNNModel<L> extends Object implements IgniteModel<Vector,L>, SpatialIndex<L>
Dataset that consists
of a set of resources allocated across the cluster.| Modifier and Type | Field and Description |
|---|---|
protected DistanceMeasure |
distanceMeasure
Distance measure.
|
protected int |
k
Number of neighbours.
|
protected boolean |
weighted
Weighted or not.
|
| Modifier | Constructor and Description |
|---|---|
protected |
KNNModel(Dataset<EmptyContext,SpatialIndex<L>> dataset,
DistanceMeasure distanceMeasure,
int k,
boolean weighted)
Constructs a new instance of KNN model.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
List<LabeledVector<L>> |
findKClosest(int k,
Vector pnt)
Finds
k closest elements to the specified point. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected final DistanceMeasure distanceMeasure
protected final int k
protected final boolean weighted
protected KNNModel(Dataset<EmptyContext,SpatialIndex<L>> dataset, DistanceMeasure distanceMeasure, int k, boolean weighted)
dataset - Dataset with SpatialIndex as a partition data.distanceMeasure - Distance measure.k - Number of neighbours.weighted - Weighted or not.public List<LabeledVector<L>> findKClosest(int k, Vector pnt)
k closest elements to the specified point.findKClosest in interface SpatialIndex<L>k - Number of elements to be returned.pnt - Point to be used to calculate distance to other points.k closest elements to the specified point.public void close()
close in interface AutoCloseableclose in interface IgniteModel<Vector,L>close in interface Model<Vector,L>close in interface SpatialIndex<L>
GridGain In-Memory Computing Platform : ver. 8.9.26 Release Date : October 16 2025