## Class 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 ManhattanDistance instead, 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 class  HistogramMatchDistance.Par
Parameterization class, using the static instance.
• ### Field Summary

Fields
Modifier and Type Field Description
static HistogramMatchDistance STATIC
Static instance.
• ### Constructor Summary

Constructors
Constructor Description
HistogramMatchDistance()
Deprecated.
Use static instance!
• ### Method Summary

All Methods
Modifier and Type Method Description
double distance​(NumberVector v1, NumberVector v2)
Computes the distance between two given DatabaseObjects according to this distance function.
boolean equals​(java.lang.Object obj)
int hashCode()
boolean isMetric()
Is this distance function metric (satisfy the triangle inequality)
double minDist​(SpatialComparable mbr1, SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this distance function.
java.lang.String toString()
• ### 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!
• ### Constructor Detail

• #### HistogramMatchDistance

@Deprecated
public HistogramMatchDistance()
Deprecated.
Use static instance!
Constructor for the Histogram match distance function.
• ### Method Detail

• #### distance

public double distance​(NumberVector v1,
NumberVector v2)
Description copied from interface: PrimitiveDistance
Computes the distance between two given DatabaseObjects according to this distance function.
Specified by:
distance in interface NumberVectorDistance<NumberVector>
Specified by:
distance in interface PrimitiveDistance<NumberVector>
Parameters:
v1 - first DatabaseObject
v2 - 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: SpatialPrimitiveDistance
Computes the distance between the two given MBRs according to this distance function.
Specified by:
minDist in interface SpatialPrimitiveDistance<NumberVector>
Parameters:
mbr1 - the first MBR object
mbr2 - 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: Distance
Is this distance function metric (satisfy the triangle inequality)
Specified by:
isMetric in interface Distance<NumberVector>
Returns:
true when metric.
• #### toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
• #### equals

public boolean equals​(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
• #### hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object