Package elki.distance.histogram
Class HistogramMatchDistance
- java.lang.Object
-
- elki.distance.AbstractNumberVectorDistance
-
- elki.distance.histogram.HistogramMatchDistance
-
- All Implemented Interfaces:
Distance<NumberVector>,NumberVectorDistance<NumberVector>,PrimitiveDistance<NumberVector>,SpatialPrimitiveDistance<NumberVector>
@Reference(authors="L. N. Vaserstein", title="Markov processes over denumerable products of spaces describing large systems of automata", booktitle="Problemy Peredachi Informatsii 5.3 / Problems of Information Transmission, 5:3", url="http://mi.mathnet.ru/eng/ppi1811", bibkey="journals/misc/Vaserstein69") public class HistogramMatchDistance extends AbstractNumberVectorDistance implements SpatialPrimitiveDistance<NumberVector>
Distance function based on histogram matching, i.e., Manhattan distance on the cumulative density function.If your data is normalized to the 1-norm of 1, use
ManhattanDistanceinstead, as this will be faster!This distance function assumes there exist a natural order in the vectors, i.e., they should be some 1-dimensional histogram.
This is also known as Earth Movers Distance (EMD), 1st Mallows distance or 1st Wasserstein metric (also Vasershtein metric), for the special case of a one-dimensional histogram, where the cost is linear in the number of bins to transport.
Reference:
L. N. Vaserstein
Markov processes over denumerable products of spaces describing large systems of automata
Problemy Peredachi Informatsii 5.3 / Problems of Information Transmission 5:3- Since:
- 0.6.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHistogramMatchDistance.ParParameterization class, using the static instance.
-
Field Summary
Fields Modifier and Type Field Description static HistogramMatchDistanceSTATICStatic instance.
-
Constructor Summary
Constructors Constructor Description HistogramMatchDistance()Deprecated.Use static instance!
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubledistance(NumberVector v1, NumberVector v2)Computes the distance between two given DatabaseObjects according to this distance function.booleanequals(java.lang.Object obj)inthashCode()booleanisMetric()Is this distance function metric (satisfy the triangle inequality)doubleminDist(SpatialComparable mbr1, SpatialComparable mbr2)Computes the distance between the two given MBRs according to this distance function.java.lang.StringtoString()-
Methods inherited from class elki.distance.AbstractNumberVectorDistance
dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, getInputTypeRestriction
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface elki.distance.Distance
isSquared, isSymmetric
-
Methods inherited from interface elki.distance.PrimitiveDistance
getInputTypeRestriction
-
Methods inherited from interface elki.distance.SpatialPrimitiveDistance
instantiate
-
-
-
-
Field Detail
-
STATIC
public static final HistogramMatchDistance STATIC
Static instance. Use this!
-
-
Method Detail
-
distance
public double distance(NumberVector v1, NumberVector v2)
Description copied from interface:PrimitiveDistanceComputes the distance between two given DatabaseObjects according to this distance function.- Specified by:
distancein interfaceNumberVectorDistance<NumberVector>- Specified by:
distancein interfacePrimitiveDistance<NumberVector>- Parameters:
v1- first DatabaseObjectv2- second DatabaseObject- Returns:
- the distance between two given DatabaseObjects according to this distance function
-
minDist
public double minDist(SpatialComparable mbr1, SpatialComparable mbr2)
Description copied from interface:SpatialPrimitiveDistanceComputes the distance between the two given MBRs according to this distance function.- Specified by:
minDistin interfaceSpatialPrimitiveDistance<NumberVector>- Parameters:
mbr1- the first MBR objectmbr2- the second MBR object- Returns:
- the distance between the two given MBRs according to this distance function
-
isMetric
public boolean isMetric()
Description copied from interface:DistanceIs this distance function metric (satisfy the triangle inequality)- Specified by:
isMetricin interfaceDistance<NumberVector>- Returns:
truewhen metric.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-