InputType
- Type of Vectorizable data upon which we determine
similarity.OutputType
- Output of the evaluator, like Matrix, Double, Stringpublic class NearestNeighborKDTree<InputType extends Vectorizable,OutputType> extends AbstractNearestNeighbor<InputType,OutputType>
Modifier and Type | Class and Description |
---|---|
static class |
NearestNeighborKDTree.Learner<InputType extends Vectorizable,OutputType>
This is a BatchLearner interface for creating a new NearestNeighbor
from a given dataset, simply a pass-through to the constructor of
NearestNeighbor
|
divergenceFunction
Constructor and Description |
---|
NearestNeighborKDTree()
Creates a new instance of
NearestNeighborKDTree . |
NearestNeighborKDTree(KDTree<InputType,OutputType,InputOutputPair<? extends InputType,OutputType>> data,
DivergenceFunction<? super InputType,? super InputType> divergenceFunction)
Creates a new instance of NearestNeighborKDTree
|
Modifier and Type | Method and Description |
---|---|
NearestNeighborKDTree<InputType,OutputType> |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
OutputType |
evaluate(InputType input)
Evaluates the function on the given input and returns the output.
|
KDTree<InputType,OutputType,InputOutputPair<? extends InputType,OutputType>> |
getData()
Getter for data
|
Metric<? super InputType> |
getDivergenceFunction()
Setter for distanceFunction
|
void |
setData(KDTree<InputType,OutputType,InputOutputPair<? extends InputType,OutputType>> data)
Setter for data
|
void |
setDivergenceFunction(DivergenceFunction<? super InputType,? super InputType> divergenceFunction)
Sets the divergence function used by this object.
|
void |
setDivergenceFunction(Metric<? super InputType> divergenceFunction)
Sets the Metric to use.
|
add
public NearestNeighborKDTree()
NearestNeighborKDTree
.public NearestNeighborKDTree(KDTree<InputType,OutputType,InputOutputPair<? extends InputType,OutputType>> data, DivergenceFunction<? super InputType,? super InputType> divergenceFunction)
data
- Underlying data for the classifierdivergenceFunction
- Divergence function that determines how "far" two objects are apartpublic NearestNeighborKDTree<InputType,OutputType> clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class DefaultDivergenceFunctionContainer<InputType extends Vectorizable,InputType extends Vectorizable>
public Metric<? super InputType> getDivergenceFunction()
getDivergenceFunction
in interface NearestNeighbor<InputType extends Vectorizable,OutputType>
getDivergenceFunction
in interface DivergenceFunctionContainer<InputType extends Vectorizable,InputType extends Vectorizable>
getDivergenceFunction
in class DefaultDivergenceFunctionContainer<InputType extends Vectorizable,InputType extends Vectorizable>
public void setDivergenceFunction(DivergenceFunction<? super InputType,? super InputType> divergenceFunction)
DefaultDivergenceFunctionContainer
setDivergenceFunction
in class DefaultDivergenceFunctionContainer<InputType extends Vectorizable,InputType extends Vectorizable>
divergenceFunction
- The divergence function.public void setDivergenceFunction(Metric<? super InputType> divergenceFunction)
divergenceFunction
- Metric that determines closeness.public KDTree<InputType,OutputType,InputOutputPair<? extends InputType,OutputType>> getData()
public void setData(KDTree<InputType,OutputType,InputOutputPair<? extends InputType,OutputType>> data)
data
- KDTree that holds the data to search for neighbors.public OutputType evaluate(InputType input)
Evaluator
input
- The input to evaluate.