Package elki.distance.probabilistic
Class TriangularDiscriminationDistance
- java.lang.Object
-
- elki.distance.AbstractNumberVectorDistance
-
- elki.distance.probabilistic.TriangularDiscriminationDistance
-
- All Implemented Interfaces:
Distance<NumberVector>
,NumberVectorDistance<NumberVector>
,PrimitiveDistance<NumberVector>
,SpatialPrimitiveDistance<NumberVector>
- Direct Known Subclasses:
TriangularDistance
@Reference(authors="F. Tops\u00f8e", title="Some inequalities for information divergence and related measures of discrimination", booktitle="IEEE Transactions on information theory, 46(4)", url="https://doi.org/10.1109/18.850703", bibkey="DBLP:journals/tit/Topsoe00") public class TriangularDiscriminationDistance extends AbstractNumberVectorDistance implements SpatialPrimitiveDistance<NumberVector>
Triangular Discrimination has relatively tight upper and lower bounds to the Jensen-Shannon divergence, but is much less expensive.\[\text{Triangular-Discrimination}(\vec{x},\vec{y}):= \sum\nolimits_i \tfrac{|x_i-y_i|^2}{x_i+y_i}\]
This distance function is meant for distribution vectors that sum to 1, and does not work on negative values.
See also
TriangularDistance
for a metric version.Reference:
F. Topsøe
Some inequalities for information divergence and related measures of discrimination
IEEE Transactions on information theory, 46(4).TODO: support sparse vectors, varying length
- Since:
- 0.7.5
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TriangularDiscriminationDistance.Par
Parameterization class, using the static instance.
-
Field Summary
Fields Modifier and Type Field Description static TriangularDiscriminationDistance
STATIC
Static instance.
-
Constructor Summary
Constructors Constructor Description TriangularDiscriminationDistance()
Deprecated.Use static instance!
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
distance(NumberVector v1, NumberVector v2)
Computes the distance between two given DatabaseObjects according to this distance function.boolean
equals(java.lang.Object obj)
int
hashCode()
boolean
isSquared()
Squared distances, that would become metric after square root.double
minDist(SpatialComparable mbr1, SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this distance function.java.lang.String
toString()
-
Methods inherited from class elki.distance.AbstractNumberVectorDistance
dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, getInputTypeRestriction
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface elki.distance.Distance
isMetric, isSymmetric
-
Methods inherited from interface elki.distance.PrimitiveDistance
getInputTypeRestriction
-
Methods inherited from interface elki.distance.SpatialPrimitiveDistance
instantiate
-
-
-
-
Field Detail
-
STATIC
public static final TriangularDiscriminationDistance STATIC
Static instance. Use this!
-
-
Constructor Detail
-
TriangularDiscriminationDistance
@Deprecated public TriangularDiscriminationDistance()
Deprecated.Use static instance!Constructor for the Triangular Discrimination - useSTATIC
instead.
-
-
Method Detail
-
distance
public double distance(NumberVector v1, NumberVector v2)
Description copied from interface:PrimitiveDistance
Computes the distance between two given DatabaseObjects according to this distance function.- Specified by:
distance
in interfaceNumberVectorDistance<NumberVector>
- Specified by:
distance
in interfacePrimitiveDistance<NumberVector>
- Parameters:
v1
- first DatabaseObjectv2
- second DatabaseObject- Returns:
- the distance between two given DatabaseObjects according to this distance function
-
minDist
public double minDist(SpatialComparable mbr1, SpatialComparable mbr2)
Description copied from interface:SpatialPrimitiveDistance
Computes the distance between the two given MBRs according to this distance function.- Specified by:
minDist
in interfaceSpatialPrimitiveDistance<NumberVector>
- Parameters:
mbr1
- the first MBR objectmbr2
- the second MBR object- Returns:
- the distance between the two given MBRs according to this distance function
-
isSquared
public boolean isSquared()
Description copied from interface:Distance
Squared distances, that would become metric after square root.E.g. squared Euclidean.
- Specified by:
isSquared
in interfaceDistance<NumberVector>
- Returns:
true
when squared.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-