Documentation of 'smile.neighbor.Neighbor' Java class
Neighbor
smile.neighbor

Class 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
      double distance
      The distance between the query and the neighbor.
      int index
      The index of neighbor object in the dataset.
      K key
      The key of neighbor.
      V value
      The data object of neighbor.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Neighbor(K key, V object, int index, double distance)
      Constructor.
    • 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.
    • Constructor Detail

      • Neighbor

        public Neighbor(K key,
                        V object,
                        int index,
                        double distance)
        Constructor.
        Parameters:
        object - the neighbor object.
        index - the index of neighbor object in the dataset.
        distance - the distance between the query and the neighbor.
    • Method Detail

      • compareTo

        public int compareTo(Neighbor<K,V> o)
        Specified by:
        compareTo in interface java.lang.Comparable<Neighbor<K,V>>

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.