![JAR search and dependency download from the Maven repository](/logo.png)
com.github.TKnudsen.ComplexDataObject.model.distanceMeasure.Double.EarthMoverDistance Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of complex-data-object Show documentation
Show all versions of complex-data-object Show documentation
A library that models real-world objects in Java, referred to as ComplexDataObjects. Other features: IO and preprocessing of ComplexDataObjects.
The newest version!
package com.github.TKnudsen.ComplexDataObject.model.distanceMeasure.Double;
import org.apache.commons.math3.ml.distance.EarthMoversDistance;
public class EarthMoverDistance extends DoubleDistanceMeasure {
/**
*
*/
private static final long serialVersionUID = -9139238493346028987L;
EarthMoversDistance emd = new EarthMoversDistance();
@Override
public double getDistance(double[] o1, double[] o2) {
if (o1 == null || o2 == null)
throw new NullPointerException(getName() + ": given array was null");
if (o1.length != o2.length)
throw new IllegalArgumentException(getName() + ": given arrays have different length");
return emd.compute(o1, o2);
}
@Override
public String getName() {
return "Earth Mover Distance";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy