Package elki.database.ids
Interface KNNList
-
- All Superinterfaces:
DBIDs
,DoubleDBIDList
- All Known Implementing Classes:
DoubleIntegerDBIDKNNList
,IntegerDBIDKNNSubList
public interface KNNList extends DoubleDBIDList
Interface for kNN results.To iterate over the results, use the following code:
for (DistanceDBIDResultIter<D> iter = result.iter(); iter.valid(); iter.advance()) { // You can get the distance via: iter.getDistance(); // Or use iter just like any other DBIDRef }
for (DBIDIter<D> iter = result.iter(); iter.valid(); iter.advance()) { // Use iter just like any other DBIDRef }
- Since:
- 0.5.5
- Author:
- Erich Schubert
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface elki.database.ids.DoubleDBIDList
DoubleDBIDList.Consumer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getK()
Get the K parameter (note: this may be less than the size of the list!)double
getKNNDistance()
Get the distance to the k nearest neighbor, or infinity otherwise.KNNList
map(java.util.function.DoubleUnaryOperator f)
Function to project the knn list.KNNList
subList(int k)
Select a subset for a smaller k.-
Methods inherited from interface elki.database.ids.DoubleDBIDList
assignVar, doubleValue, forEachDouble, iter, size, slice
-
-
-
-
Method Detail
-
getK
int getK()
Get the K parameter (note: this may be less than the size of the list!)- Returns:
- K
-
getKNNDistance
double getKNNDistance()
Get the distance to the k nearest neighbor, or infinity otherwise.- Returns:
- Maximum distance
-
subList
KNNList subList(int k)
Select a subset for a smaller k.- Parameters:
k
- New k- Returns:
- KNN result for the smaller k.
-
map
KNNList map(java.util.function.DoubleUnaryOperator f)
Function to project the knn list.- Parameters:
f
- Function to transform values- Returns:
- projected list
-
-