public class CosineDistanceMetric extends AbstractCloneableSerializable implements Semimetric<Vectorizable>
CosineDistanceMetricclass implements a semimetric between two vectors based on the cosine between the vectors. Since cosine is typically used as a similarity measure, to convert it to a semimetric, one minus the cosine is computed. d(x, y) = 1.0 - cos(x, y) = 1.0 - (x * y) / (||x|| * ||y||)
|Modifier and Type||Field and Description|
An instance of
|Constructor and Description|
Creates a new instance of
|Modifier and Type||Method and Description|
Evaluates the cosine distance between the two given vectors.
public static final CosineDistanceMetric INSTANCE
CosineDistanceMetricto use since this class has no internal data.
public double evaluate(Vectorizable first, Vectorizable second)