gov.sandia.cognition.learning.algorithm.nearest
Class KNearestNeighborKDTree.Learner<InputType extends Vectorizable,OutputType>
java.lang.Object
gov.sandia.cognition.util.AbstractCloneableSerializable
gov.sandia.cognition.learning.function.distance.DefaultDivergenceFunctionContainer<InputType,InputType>
gov.sandia.cognition.learning.algorithm.nearest.AbstractNearestNeighbor<InputType,OutputType>
gov.sandia.cognition.learning.algorithm.nearest.AbstractKNearestNeighbor<InputType,OutputType>
gov.sandia.cognition.learning.algorithm.nearest.KNearestNeighborKDTree<InputType,OutputType>
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 StringOutputType
- 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
Methods inherited from interface gov.sandia.cognition.learning.algorithm.nearest.NearestNeighbor |
add |
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 zerodivergenceFunction
- Divergence function that determines how "far" two objects are apart,
where lower values indicate two objects are more similaraverager
- Creates a single object from a collection of data
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.