smile.neighbor
Class Neighbor<K,V>
- java.lang.Object
-
- smile.neighbor.Neighbor<K,V>
-
- Type Parameters:
K- the type of keys.V- the type of associated objects.
- All Implemented Interfaces:
- java.lang.Comparable<Neighbor<K,V>>
- Direct Known Subclasses:
- SimpleNeighbor
public class Neighbor<K,V> extends java.lang.Object implements java.lang.Comparable<Neighbor<K,V>>
The object encapsulates the results of nearest neighbor search. A returned neighbor for nearest neighbor search contains the key of object (say weight vector of a neuron) and the object itself (say a neuron in neural network, which also contains other information beyond weight vector), an index of object in the dataset, which is often useful, and the distance between the query key to the object key.
-
-
Field Summary
Fields Modifier and Type Field and Description doubledistanceThe distance between the query and the neighbor.intindexThe index of neighbor object in the dataset.KkeyThe key of neighbor.VvalueThe data object of neighbor.
-
Constructor Summary
Constructors Constructor and Description Neighbor(K key, V object, int index, double distance)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcompareTo(Neighbor<K,V> o)
-
-
-
Field Detail
-
key
public K key
The key of neighbor.
-
value
public V value
The data object of neighbor. It may be same as the key object.
-
index
public int index
The index of neighbor object in the dataset.
-
distance
public double distance
The distance between the query and the neighbor.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG