 de.lmu.ifi.dbs.elki.distance.distancefunction.histogram

## Class HistogramMatchDistanceFunction

• All Implemented Interfaces:
DistanceFunction<NumberVector>, NumberVectorDistanceFunction<NumberVector>, PrimitiveDistanceFunction<NumberVector>, SpatialPrimitiveDistanceFunction<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 HistogramMatchDistanceFunction
extends AbstractNumberVectorDistanceFunction
implements SpatialPrimitiveDistanceFunction<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 ManhattanDistanceFunction 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 and Description
static class  HistogramMatchDistanceFunction.Parameterizer
Parameterization class, using the static instance.
• ### Field Summary

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

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

All Methods
Modifier and Type Method and 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 de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractNumberVectorDistanceFunction

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 de.lmu.ifi.dbs.elki.distance.distancefunction.SpatialPrimitiveDistanceFunction

instantiate
• ### Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.PrimitiveDistanceFunction

getInputTypeRestriction
• ### Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction

isSquared, isSymmetric
• ### Field Detail

• #### STATIC

public static final HistogramMatchDistanceFunction STATIC
Static instance. Use this!
• ### Constructor Detail

• #### HistogramMatchDistanceFunction

@Deprecated
public HistogramMatchDistanceFunction()
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: PrimitiveDistanceFunction
Computes the distance between two given DatabaseObjects according to this distance function.
Specified by:
distance in interface NumberVectorDistanceFunction<NumberVector>
Specified by:
distance in interface PrimitiveDistanceFunction<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: SpatialPrimitiveDistanceFunction
Computes the distance between the two given MBRs according to this distance function.
Specified by:
minDist in interface SpatialPrimitiveDistanceFunction<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: DistanceFunction
Is this distance function metric (satisfy the triangle inequality)
Specified by:
isMetric in interface DistanceFunction<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