gov.sandia.cognition.learning.algorithm.nearest
Class KNearestNeighborKDTree.Learner<InputType extends Vectorizable,OutputType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.function.distance.DefaultDivergenceFunctionContainer<InputType,InputType>
          extended by gov.sandia.cognition.learning.algorithm.nearest.AbstractNearestNeighbor<InputType,OutputType>
              extended by gov.sandia.cognition.learning.algorithm.nearest.AbstractKNearestNeighbor<InputType,OutputType>
                  extended by gov.sandia.cognition.learning.algorithm.nearest.KNearestNeighborKDTree<InputType,OutputType>
                      extended by gov.sandia.cognition.learning.algorithm.nearest.KNearestNeighborKDTree.Learner<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 Implemented Interfaces:
Evaluator<InputType,OutputType>, BatchLearner<Collection<? extends InputOutputPair<? extends InputType,OutputType>>,KNearestNeighborKDTree<InputType,OutputType>>, KNearestNeighbor<InputType,OutputType>, NearestNeighbor<InputType,OutputType>, SupervisedBatchLearner<InputType,OutputType,KNearestNeighborKDTree<InputType,OutputType>>, DivergenceFunctionContainer<InputType,InputType>, CloneableSerializable, Serializable, Cloneable
Enclosing class:
KNearestNeighborKDTree<InputType extends Vectorizable,OutputType>

public static class KNearestNeighborKDTree.Learner<InputType extends Vectorizable,OutputType>
extends KNearestNeighborKDTree<InputType,OutputType>
implements SupervisedBatchLearner<InputType,OutputType,KNearestNeighborKDTree<InputType,OutputType>>

This is a BatchLearner interface for creating a new KNearestNeighbor from a given dataset, simply a pass-through to the constructor of KNearestNeighbor

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class gov.sandia.cognition.learning.algorithm.nearest.KNearestNeighborKDTree
KNearestNeighborKDTree.Learner<InputType extends Vectorizable,OutputType>
 
Field Summary
 
Fields inherited from class gov.sandia.cognition.learning.function.distance.DefaultDivergenceFunctionContainer
divergenceFunction
 
Fields inherited from interface gov.sandia.cognition.learning.algorithm.nearest.KNearestNeighbor
DEFAULT_K
 
Constructor Summary
KNearestNeighborKDTree.Learner()
          Default constructor.
KNearestNeighborKDTree.Learner(int k, Metric<? super Vectorizable> divergenceFunction, Summarizer<? super OutputType,? extends OutputType> averager)
          Creates a new instance of Learner
KNearestNeighborKDTree.Learner(Summarizer<? super OutputType,? extends OutputType> averager)
          Creates a new instance of Learner.
 
Method Summary
 KNearestNeighborKDTree<InputType,OutputType> learn(Collection<? extends InputOutputPair<? extends InputType,OutputType>> data)
          Creates a new KNearestNeighbor from a Collection of InputType.
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.nearest.KNearestNeighborKDTree
clone, computeNeighborhood, getData, getDivergenceFunction, rebalance, setData, setDivergenceFunction, setDivergenceFunction
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.nearest.AbstractKNearestNeighbor
evaluate, getAverager, getK, setAverager, setK
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.nearest.AbstractNearestNeighbor
add
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 
Methods inherited from interface gov.sandia.cognition.evaluator.Evaluator
evaluate
 
Methods inherited from interface gov.sandia.cognition.learning.algorithm.nearest.NearestNeighbor
add
 

Constructor Detail

KNearestNeighborKDTree.Learner

public KNearestNeighborKDTree.Learner()
Default constructor.


KNearestNeighborKDTree.Learner

public KNearestNeighborKDTree.Learner(Summarizer<? super OutputType,? extends OutputType> averager)
Creates a new instance of Learner.

Parameters:
averager - Creates a single object from a collection of data.

KNearestNeighborKDTree.Learner

public KNearestNeighborKDTree.Learner(int k,
                                      Metric<? super Vectorizable> divergenceFunction,
                                      Summarizer<? super OutputType,? extends OutputType> averager)
Creates a new instance of Learner

Parameters:
k - Number of neighbors to consider, must be greater than zero
divergenceFunction - Divergence function that determines how "far" two objects are apart, where lower values indicate two objects are more similar
averager - Creates a single object from a collection of data
Method Detail

learn

public KNearestNeighborKDTree<InputType,OutputType> learn(Collection<? extends InputOutputPair<? extends InputType,OutputType>> data)
Creates a new KNearestNeighbor from a Collection of InputType. We build a balanced KDTree with the data, which is an O(n log(n)) operator for n data points.

Specified by:
learn in interface BatchLearner<Collection<? extends InputOutputPair<? extends InputType extends Vectorizable,OutputType>>,KNearestNeighborKDTree<InputType extends Vectorizable,OutputType>>
Parameters:
data - Dataset from which to create a new KNearestNeighbor
Returns:
KNearestNeighbor based on the given dataset with a balanced KDTree.