gov.sandia.cognition.learning.algorithm.nearest
Interface NearestNeighbor<InputType,OutputType>

Type Parameters:
InputType - Type of data upon which the KNearestNeighbor operates, something like Vector, Double, or String
OutputType - Output of the evaluator, like Matrix, Double, String
All Superinterfaces:
Cloneable, CloneableSerializable, Evaluator<InputType,OutputType>, Serializable
All Known Subinterfaces:
KNearestNeighbor<InputType,OutputType>
All Known Implementing Classes:
AbstractKNearestNeighbor, AbstractNearestNeighbor, KNearestNeighborExhaustive, KNearestNeighborExhaustive.Learner, KNearestNeighborKDTree, KNearestNeighborKDTree.Learner, NearestNeighborExhaustive, NearestNeighborKDTree, NearestNeighborKDTree.Learner

@PublicationReference(author="Wikipedia",
                      title="k-nearest neighbor algorithm",
                      type=WebPage,
                      year=2008,
                      url="http://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm")
public interface NearestNeighbor<InputType,OutputType>
extends Evaluator<InputType,OutputType>, CloneableSerializable

The NearestNeighborExhaustive class implements a simple evaluator that looks up a given input object in a collection of input-output pair examples and returns the output associated with the most similar input. Similarity is judged using the given divergence function. This is an implementation of the standard nearest-neighbor algorithm, which is a corner case of the k-nearest neighbor algorithm, implemented in the KNearestNeighbor class.

Since:
3.0
Author:
Kevin R. Dixon

Method Summary
 void add(InputOutputPair<? extends InputType,OutputType> value)
          Adds the Pair to the data.
 Collection<InputOutputPair<? extends InputType,OutputType>> getData()
          Gets the data from which this computes the nearest neighbors.
 DivergenceFunction<? super InputType,? super InputType> getDivergenceFunction()
          Getter for divergenceFunction
 
Methods inherited from interface gov.sandia.cognition.evaluator.Evaluator
evaluate
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Method Detail

add

void add(InputOutputPair<? extends InputType,OutputType> value)
Adds the Pair to the data.

Parameters:
value - Value to add to the data.

getDivergenceFunction

DivergenceFunction<? super InputType,? super InputType> getDivergenceFunction()
Getter for divergenceFunction

Returns:
Divergence function that determines how "far" two objects are apart

getData

Collection<InputOutputPair<? extends InputType,OutputType>> getData()
Gets the data from which this computes the nearest neighbors.

Returns:
Collection of the data Pairs.