@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, wait
instantiate
isSquared, isSymmetric
public 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)
SpatialPrimitiveDistanceFunction
minDist
in interface SpatialPrimitiveDistanceFunction<NumberVector>
mbr1
- the first MBR objectmbr2
- the second MBR objectpublic boolean isMetric()
DistanceFunction
isMetric
in interface DistanceFunction<NumberVector>
true
when metric.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public SimpleTypeInformation<? super NumberVector> getInputTypeRestriction()
DistanceFunction
getInputTypeRestriction
in interface DistanceFunction<NumberVector>
getInputTypeRestriction
in interface PrimitiveDistanceFunction<NumberVector>
Copyright © 2019 ELKI Development Team. License information.