public interface DistanceFunction extends OptionHandler
Modifier and Type | Method and Description |
---|---|
void |
clean()
Free any references to training instances
|
double |
distance(Instance first,
Instance second)
Calculates the distance between two instances.
|
double |
distance(Instance first,
Instance second,
double cutOffValue)
Calculates the distance between two instances.
|
double |
distance(Instance first,
Instance second,
double cutOffValue,
PerformanceStats stats)
Calculates the distance between two instances.
|
double |
distance(Instance first,
Instance second,
PerformanceStats stats)
Calculates the distance between two instances.
|
java.lang.String |
getAttributeIndices()
Gets the range of attributes used in the calculation of the distance.
|
Instances |
getInstances()
returns the instances currently set.
|
boolean |
getInvertSelection()
Gets whether the matching sense of attribute indices is inverted or not.
|
void |
postProcessDistances(double[] distances)
Does post processing of the distances (if necessary) returned by
distance(distance(Instance first, Instance second, double cutOffValue).
|
void |
setAttributeIndices(java.lang.String value)
Sets the range of attributes to use in the calculation of the distance.
|
void |
setInstances(Instances insts)
Sets the instances.
|
void |
setInvertSelection(boolean value)
Sets whether the matching sense of attribute indices is inverted or not.
|
void |
update(Instance ins)
Update the distance function (if necessary) for the newly added instance.
|
getOptions, listOptions, setOptions
void setInstances(Instances insts)
insts
- the instances to useInstances getInstances()
void setAttributeIndices(java.lang.String value)
value
- the new attribute index rangejava.lang.String getAttributeIndices()
void setInvertSelection(boolean value)
value
- if true the matching sense is invertedboolean getInvertSelection()
double distance(Instance first, Instance second)
first
- the first instancesecond
- the second instancedouble distance(Instance first, Instance second, PerformanceStats stats) throws java.lang.Exception
first
- the first instancesecond
- the second instancestats
- the performance stats objectjava.lang.Exception
- if calculation failsdouble distance(Instance first, Instance second, double cutOffValue)
first
- the first instancesecond
- the second instancecutOffValue
- If the distance being calculated becomes larger than
cutOffValue then the rest of the calculation is discarded.double distance(Instance first, Instance second, double cutOffValue, PerformanceStats stats)
first
- the first instancesecond
- the second instancecutOffValue
- If the distance being calculated becomes larger than
cutOffValue then the rest of the calculation is discarded.stats
- the performance stats objectvoid postProcessDistances(double[] distances)
distances
- the distances to post-processvoid update(Instance ins)
ins
- the instance to addvoid clean()