public class MinkowskiDistance extends NormalizableDistance implements java.lang.Cloneable, TechnicalInformationHandler
@misc{missing_id, author = {Wikipedia}, title = {Minkowski distance}, URL = {http://en.wikipedia.org/wiki/Minkowski_distance} }Valid options are:
-P <order> The order 'p'. With '1' being the Manhattan distance and '2' the Euclidean distance. (default: 2)
-D Turns off the normalization of attribute values in distance calculation.
-R <col1,col2-col4,...> Specifies list of columns to used in the calculation of the distance. 'first' and 'last' are valid indices. (default: first-last)
-V Invert matching sense of column indices.
R_MAX, R_MIN, R_WIDTH
Constructor and Description |
---|
MinkowskiDistance()
Constructs an Minkowski Distance object, Instances must be still set.
|
MinkowskiDistance(Instances data)
Constructs an Minkowski Distance object and automatically initializes the
ranges.
|
Modifier and Type | Method and Description |
---|---|
double |
distance(Instance first,
Instance second)
Calculates the distance between two instances.
|
double |
distance(Instance first,
Instance second,
PerformanceStats stats)
Calculates the distance (or similarity) between two instances.
|
java.lang.String[] |
getOptions()
Gets the current settings of this object.
|
double |
getOrder()
Gets the order.
|
java.lang.String |
getRevision()
Returns the revision string.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed
information about the technical background of this class, e.g., paper
reference or book this class is based on.
|
java.lang.String |
globalInfo()
Returns a string describing this object.
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
java.lang.String |
orderTipText()
Returns the tip text for this property.
|
void |
postProcessDistances(double[] distances)
Does post processing of the distances (if necessary) returned by
distance(distance(Instance first, Instance second, double cutOffValue).
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setOrder(double value)
Sets the order.
|
attributeIndicesTipText, clean, distance, distance, dontNormalizeTipText, getAttributeIndices, getDontNormalize, getInstances, getInvertSelection, getRanges, initializeRanges, initializeRanges, initializeRanges, initializeRangesEmpty, inRanges, invertSelectionTipText, rangesSet, setAttributeIndices, setDontNormalize, setInstances, setInvertSelection, toString, update, updateRanges, updateRanges, updateRanges, updateRangesFirst
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
makeCopy
public MinkowskiDistance()
public MinkowskiDistance(Instances data)
data
- the instances the distance function should work onpublic java.lang.String globalInfo()
globalInfo
in class NormalizableDistance
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public java.util.Enumeration<Option> listOptions()
listOptions
in interface OptionHandler
listOptions
in class NormalizableDistance
public void setOptions(java.lang.String[] options) throws java.lang.Exception
setOptions
in interface OptionHandler
setOptions
in class NormalizableDistance
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class NormalizableDistance
public java.lang.String orderTipText()
public void setOrder(double value)
value
- the new orderpublic double getOrder()
public double distance(Instance first, Instance second)
distance
in interface DistanceFunction
distance
in class NormalizableDistance
first
- the first instancesecond
- the second instancepublic double distance(Instance first, Instance second, PerformanceStats stats)
distance
in interface DistanceFunction
distance
in class NormalizableDistance
first
- the first instancesecond
- the second instancestats
- the structure for storing performance statistics.public void postProcessDistances(double[] distances)
postProcessDistances
in interface DistanceFunction
postProcessDistances
in class NormalizableDistance
distances
- the distances to post-processpublic java.lang.String getRevision()
getRevision
in interface RevisionHandler