Package weka.core
Class AbstractStringDistanceFunction
java.lang.Object
weka.core.NormalizableDistance
weka.core.AbstractStringDistanceFunction
- All Implemented Interfaces:
Serializable
,DistanceFunction
,OptionHandler
,RevisionHandler
- Direct Known Subclasses:
EditDistance
Represents the abstract ancestor for string-based distance functions, like
EditDistance.
- Version:
- $Revision: 1.1 $
- Author:
- Bruno Woltzenlogel Paleo
- See Also:
-
Field Summary
Fields inherited from class weka.core.NormalizableDistance
R_MAX, R_MIN, R_WIDTH
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor that doesn't set the dataConstructor that sets the data -
Method Summary
Modifier and TypeMethodDescriptiondouble
distance
(Instance first, Instance second, double cutOffValue, PerformanceStats stats) Calculates the distance between two instances.Methods inherited from class weka.core.NormalizableDistance
attributeIndicesTipText, clean, distance, distance, distance, dontNormalizeTipText, getAttributeIndices, getDontNormalize, getInstances, getInvertSelection, getOptions, getRanges, globalInfo, initializeRanges, initializeRanges, initializeRanges, initializeRangesEmpty, inRanges, invertSelectionTipText, listOptions, postProcessDistances, rangesSet, setAttributeIndices, setDontNormalize, setInstances, setInvertSelection, setOptions, toString, update, updateRanges, updateRanges, updateRanges, updateRangesFirst
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface weka.core.RevisionHandler
getRevision
-
Constructor Details
-
AbstractStringDistanceFunction
public AbstractStringDistanceFunction()Constructor that doesn't set the data -
AbstractStringDistanceFunction
Constructor that sets the data- Parameters:
data
- the set of instances that will be used for later distance comparisons
-
-
Method Details
-
distance
Calculates the distance between two instances. Offers speed up (if the distance function class in use supports it) in nearest neighbour search by taking into account the cutOff or maximum distance. Depending on the distance function class, post processing of the distances by postProcessDistances(double []) may be required if this function is used.- Specified by:
distance
in interfaceDistanceFunction
- Overrides:
distance
in classNormalizableDistance
- Parameters:
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 object- Returns:
- the distance between the two given instances or Double.POSITIVE_INFINITY if the distance being calculated becomes larger than cutOffValue.
-