Package elki.distance.probabilistic
Class SqrtJensenShannonDivergenceDistance
- java.lang.Object
-
- elki.distance.AbstractNumberVectorDistance
-
- elki.distance.probabilistic.JeffreyDivergenceDistance
-
- elki.distance.probabilistic.JensenShannonDivergenceDistance
-
- elki.distance.probabilistic.SqrtJensenShannonDivergenceDistance
-
- All Implemented Interfaces:
Distance<NumberVector>
,NumberVectorDistance<NumberVector>
,PrimitiveDistance<NumberVector>
,SpatialPrimitiveDistance<NumberVector>
@Reference(authors="D. M. Endres, J. E. Schindelin", title="A new metric for probability distributions", booktitle="IEEE Transactions on Information Theory 49(7)", url="https://doi.org/10.1109/TIT.2003.813506", bibkey="DBLP:journals/tit/EndresS03") public class SqrtJensenShannonDivergenceDistance extends JensenShannonDivergenceDistance
The square root of Jensen-Shannon divergence is a metric.\[\sqrt{JS}(\vec{x},\vec{y}):=\sqrt{\tfrac12\sum\nolimits_i x_i\log\tfrac{2x_i}{x_i+y_i}+y_i\log\tfrac{2y_i}{x_i+y_i}} = \sqrt{JS(\vec{x},\vec{y})}\]
A proof of triangle inequality (for "\(D_{PQ}\)") can be found in Endres and Schindelin.
References:
D. M. Endres, J. E. Schindelin
A new metric for probability distributions
IEEE Transactions on Information Theory 49(7)- Since:
- 0.6.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SqrtJensenShannonDivergenceDistance.Par
Parameterization class, using the static instance.
-
Field Summary
Fields Modifier and Type Field Description static SqrtJensenShannonDivergenceDistance
STATIC
Static instance.
-
Constructor Summary
Constructors Constructor Description SqrtJensenShannonDivergenceDistance()
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
isMetric()
Is this distance function metric (satisfy the triangle inequality)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.probabilistic.JeffreyDivergenceDistance
equals, hashCode
-
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
isSymmetric
-
Methods inherited from interface elki.distance.PrimitiveDistance
getInputTypeRestriction
-
Methods inherited from interface elki.distance.SpatialPrimitiveDistance
instantiate
-
-
-
-
Field Detail
-
STATIC
public static final SqrtJensenShannonDivergenceDistance STATIC
Static instance. Use this!
-
-
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>
- Overrides:
distance
in classJensenShannonDivergenceDistance
- 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>
- Overrides:
minDist
in classJensenShannonDivergenceDistance
- Parameters:
mbr1
- the first MBR objectmbr2
- the second MBR object- Returns:
- the distance between the two given MBRs according to this distance function
-
isMetric
public boolean isMetric()
Description copied from interface:Distance
Is this distance function metric (satisfy the triangle inequality)- Returns:
true
when metric.
-
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>
- Overrides:
isSquared
in classJeffreyDivergenceDistance
- Returns:
true
when squared.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classJensenShannonDivergenceDistance
-
-