Class EarthMoversDistance
- java.lang.Object
-
- org.apache.commons.math4.legacy.ml.distance.EarthMoversDistance
-
- All Implemented Interfaces:
DistanceMeasure
public class EarthMoversDistance extends Object implements DistanceMeasure
Calculates the Earh Mover's distance (also known as Wasserstein metric) between two distributions.- Since:
- 3.3
- See Also:
- Earth Mover's distance (Wikipedia)
-
-
Constructor Summary
Constructors Constructor Description EarthMoversDistance()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
compute(double[] a, double[] b)
Compute the distance between two n-dimensional vectors.
-
-
-
Constructor Detail
-
EarthMoversDistance
public EarthMoversDistance()
-
-
Method Detail
-
compute
public double compute(double[] a, double[] b)
Compute the distance between two n-dimensional vectors.The two vectors are required to have the same dimension.
- Specified by:
compute
in interfaceDistanceMeasure
- Parameters:
a
- the first vectorb
- the second vector- Returns:
- the distance between the two vectors
-
-