AbstractStringDistanceFunction (original) (raw)
java.lang.Object
- weka.core.NormalizableDistance
- weka.core.AbstractStringDistanceFunction
All Implemented Interfaces:
java.io.Serializable, DistanceFunction, OptionHandler, RevisionHandler
Direct Known Subclasses:
EditDistance
public abstract class AbstractStringDistanceFunction
extends NormalizableDistance
Represents the abstract ancestor for string-based distance functions, like EditDistance.
Version: Revision:1.1Revision: 1.1 Revision:1.1
Author:
Bruno Woltzenlogel Paleo
See Also:
Serialized Form
Field Summary
* ### Fields inherited from class weka.core.[NormalizableDistance](../../weka/core/NormalizableDistance.html "class in weka.core") `[R_MAX](../../weka/core/NormalizableDistance.html#R%5FMAX), [R_MIN](../../weka/core/NormalizableDistance.html#R%5FMIN), [R_WIDTH](../../weka/core/NormalizableDistance.html#R%5FWIDTH)`
Constructor Summary
Constructors
Constructor and Description AbstractStringDistanceFunction() Constructor that doesn't set the data AbstractStringDistanceFunction(Instances data) Constructor that sets the data Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type Method and Description double distance(Instance first,Instance second, double cutOffValue,PerformanceStats stats) Calculates the distance between two instances. * ### Methods inherited from class weka.core.[NormalizableDistance](../../weka/core/NormalizableDistance.html "class in weka.core") `[attributeIndicesTipText](../../weka/core/NormalizableDistance.html#attributeIndicesTipText--), [clean](../../weka/core/NormalizableDistance.html#clean--), [distance](../../weka/core/NormalizableDistance.html#distance-weka.core.Instance-weka.core.Instance-), [distance](../../weka/core/NormalizableDistance.html#distance-weka.core.Instance-weka.core.Instance-double-), [distance](../../weka/core/NormalizableDistance.html#distance-weka.core.Instance-weka.core.Instance-weka.core.neighboursearch.PerformanceStats-), [dontNormalizeTipText](../../weka/core/NormalizableDistance.html#dontNormalizeTipText--), [getAttributeIndices](../../weka/core/NormalizableDistance.html#getAttributeIndices--), [getDontNormalize](../../weka/core/NormalizableDistance.html#getDontNormalize--), [getInstances](../../weka/core/NormalizableDistance.html#getInstances--), [getInvertSelection](../../weka/core/NormalizableDistance.html#getInvertSelection--), [getOptions](../../weka/core/NormalizableDistance.html#getOptions--), [getRanges](../../weka/core/NormalizableDistance.html#getRanges--), [globalInfo](../../weka/core/NormalizableDistance.html#globalInfo--), [initializeRanges](../../weka/core/NormalizableDistance.html#initializeRanges--), [initializeRanges](../../weka/core/NormalizableDistance.html#initializeRanges-int:A-), [initializeRanges](../../weka/core/NormalizableDistance.html#initializeRanges-int:A-int-int-), [initializeRangesEmpty](../../weka/core/NormalizableDistance.html#initializeRangesEmpty-int-double:A:A-), [inRanges](../../weka/core/NormalizableDistance.html#inRanges-weka.core.Instance-double:A:A-), [invertSelectionTipText](../../weka/core/NormalizableDistance.html#invertSelectionTipText--), [listOptions](../../weka/core/NormalizableDistance.html#listOptions--), [postProcessDistances](../../weka/core/NormalizableDistance.html#postProcessDistances-double:A-), [rangesSet](../../weka/core/NormalizableDistance.html#rangesSet--), [setAttributeIndices](../../weka/core/NormalizableDistance.html#setAttributeIndices-java.lang.String-), [setDontNormalize](../../weka/core/NormalizableDistance.html#setDontNormalize-boolean-), [setInstances](../../weka/core/NormalizableDistance.html#setInstances-weka.core.Instances-), [setInvertSelection](../../weka/core/NormalizableDistance.html#setInvertSelection-boolean-), [setOptions](../../weka/core/NormalizableDistance.html#setOptions-java.lang.String:A-), [toString](../../weka/core/NormalizableDistance.html#toString--), [update](../../weka/core/NormalizableDistance.html#update-weka.core.Instance-), [updateRanges](../../weka/core/NormalizableDistance.html#updateRanges-weka.core.Instance-), [updateRanges](../../weka/core/NormalizableDistance.html#updateRanges-weka.core.Instance-double:A:A-), [updateRanges](../../weka/core/NormalizableDistance.html#updateRanges-weka.core.Instance-int-double:A:A-), [updateRangesFirst](../../weka/core/NormalizableDistance.html#updateRangesFirst-weka.core.Instance-int-double:A:A-)` * ### Methods inherited from class java.lang.Object `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait` * ### Methods inherited from interface weka.core.[RevisionHandler](../../weka/core/RevisionHandler.html "interface in weka.core") `[getRevision](../../weka/core/RevisionHandler.html#getRevision--)`
Constructor Detail
* #### AbstractStringDistanceFunction public AbstractStringDistanceFunction() Constructor that doesn't set the data * #### AbstractStringDistanceFunction public AbstractStringDistanceFunction([Instances](../../weka/core/Instances.html "class in weka.core") data) Constructor that sets the data Parameters: `data` \- the set of instances that will be used for later distance comparisons
Method Detail
* #### distance public double distance([Instance](../../weka/core/Instance.html "class in weka.core") first, [Instance](../../weka/core/Instance.html "class in weka.core") second, double cutOffValue, [PerformanceStats](../../weka/core/neighboursearch/PerformanceStats.html "class in weka.core.neighboursearch") stats) 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](../../weka/core/DistanceFunction.html#distance-weka.core.Instance-weka.core.Instance-double-weka.core.neighboursearch.PerformanceStats-)` in interface `[DistanceFunction](../../weka/core/DistanceFunction.html "interface in weka.core")` Overrides: `[distance](../../weka/core/NormalizableDistance.html#distance-weka.core.Instance-weka.core.Instance-double-weka.core.neighboursearch.PerformanceStats-)` in class `[NormalizableDistance](../../weka/core/NormalizableDistance.html "class in weka.core")` Parameters: `first` \- the first instance `second` \- the second instance `cutOffValue` \- 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.