@Priority(value=100) @Alias(value="arccos") public class ArcCosineDistanceFunction extends java.lang.Object implements SpatialPrimitiveDistanceFunction<NumberVector>, NumberVectorDistanceFunction<NumberVector>
The arc cosine distance is computed as the arcus from the cosine similarity
value, i.e., arccos(<v1,v2>).
Cosine similarity is defined as \[ \tfrac{\vec{x}\cdot\vec{y}}{||a||\cdot||b||} \] Arcus cosine distance then is \[ \text{arccos} \tfrac{\vec{x}\cdot\vec{y}}{||a||\cdot||b||} \in [0;\pi] \]
CosineDistanceFunction is a bit less expensive, and will yield the
same ranking of neighbors.
| Modifier and Type | Class and Description |
|---|---|
static class |
ArcCosineDistanceFunction.Parameterizer
Parameterization class.
|
| Modifier and Type | Field and Description |
|---|---|
static ArcCosineDistanceFunction |
STATIC
Static instance
|
| Constructor and Description |
|---|
ArcCosineDistanceFunction()
Deprecated.
Use static instance!
|
| Modifier and Type | Method and Description |
|---|---|
double |
distance(NumberVector v1,
NumberVector v2)
Computes the cosine distance for two given feature vectors.
|
boolean |
equals(java.lang.Object obj) |
SimpleTypeInformation<? super NumberVector> |
getInputTypeRestriction()
Get the input data type of the function.
|
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() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitinstantiateisSquared, isSymmetricpublic static final ArcCosineDistanceFunction STATIC
@Deprecated public ArcCosineDistanceFunction()
STATIC instead.public double distance(NumberVector v1, NumberVector v2)
arccos(<v1,v2>).distance in interface NumberVectorDistanceFunction<NumberVector>distance in interface PrimitiveDistanceFunction<NumberVector>v1 - first feature vectorv2 - second feature vectorpublic double minDist(SpatialComparable mbr1, SpatialComparable mbr2)
SpatialPrimitiveDistanceFunctionminDist in interface SpatialPrimitiveDistanceFunction<NumberVector>mbr1 - the first MBR objectmbr2 - the second MBR objectpublic boolean isMetric()
DistanceFunctionisMetric in interface DistanceFunction<NumberVector>true when metric.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic SimpleTypeInformation<? super NumberVector> getInputTypeRestriction()
DistanceFunctiongetInputTypeRestriction in interface DistanceFunction<NumberVector>getInputTypeRestriction in interface PrimitiveDistanceFunction<NumberVector>Copyright © 2019 ELKI Development Team. License information.