de.lmu.ifi.dbs.elki.distance.distancefunction.probabilistic

## Class JensenShannonDivergenceDistanceFunction

• All Implemented Interfaces:
DistanceFunction<NumberVector>, NumberVectorDistanceFunction<NumberVector>, PrimitiveDistanceFunction<NumberVector>, SpatialPrimitiveDistanceFunction<NumberVector>
Direct Known Subclasses:
SqrtJensenShannonDivergenceDistanceFunction

@Reference(authors="J. Lin",title="Divergence measures based on the Shannon entropy",booktitle="IEEE Transactions on Information Theory 37(1)",url="https://doi.org/10.1109/18.61115",bibkey="DBLP:journals/tit/Lin91") @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") @Reference(authors="M.-M. Deza, E. Deza",title="Dictionary of distances",booktitle="Dictionary of distances",url="https://doi.org/10.1007/978-3-642-00234-2",bibkey="doi:10.1007/978-3-642-00234-2")
public class JensenShannonDivergenceDistanceFunction
extends JeffreyDivergenceDistanceFunction
Jensen-Shannon Divergence for NumberVectors is a symmetric, smoothened version of the KullbackLeiblerDivergenceAsymmetricDistanceFunction.

It essentially is the same as JeffreyDivergenceDistanceFunction, only scaled by half. For completeness, we include both.

$JS(\vec{x},\vec{y}):=\tfrac12\sum\nolimits_i x_i\log\tfrac{2x_i}{x_i+y_i}+y_i\log\tfrac{2y_i}{x_i+y_i} = \tfrac12 KL(\vec{x},\tfrac12(\vec{x}+\vec{y})) + \tfrac12 KL(\vec{y},\tfrac12(\vec{x}+\vec{y}))$

There exists a variable definition where the two vectors are weighted with $$\beta$$ and $$1-\beta$$, which for the common choice of $$\beta=\tfrac12$$ yields this version.

Reference:

J. Lin
Divergence measures based on the Shannon entropy
IEEE Transactions on Information Theory 37(1)

D. M. Endres, J. E. Schindelin
A new metric for probability distributions
IEEE Transactions on Information Theory 49(7)

M.-M. Deza, E. Deza
Dictionary of distances

Since:
0.6.0
Author:
Erich Schubert
• ### Nested Class Summary

Nested Classes
Modifier and Type Class and Description
static class  JensenShannonDivergenceDistanceFunction.Parameterizer
Parameterization class, using the static instance.
• ### Field Summary

Fields
Modifier and Type Field and Description
static JensenShannonDivergenceDistanceFunction STATIC
Static instance.
• ### Constructor Summary

Constructors
Constructor and Description
JensenShannonDivergenceDistanceFunction()
Deprecated.
Use static instance!
• ### Method Summary

All Methods
Modifier and Type Method and Description
double distance(NumberVector v1, NumberVector v2)
Computes the distance between two given DatabaseObjects according to this distance function.
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 de.lmu.ifi.dbs.elki.distance.distancefunction.probabilistic.JeffreyDivergenceDistanceFunction

equals, hashCode, isSquared
• ### Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractNumberVectorDistanceFunction

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 de.lmu.ifi.dbs.elki.distance.distancefunction.SpatialPrimitiveDistanceFunction

instantiate
• ### Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.PrimitiveDistanceFunction

getInputTypeRestriction
• ### Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction

isMetric, isSymmetric
• ### Field Detail

• #### STATIC

public static final JensenShannonDivergenceDistanceFunction STATIC
Static instance. Use this!
• ### Constructor Detail

• #### JensenShannonDivergenceDistanceFunction

@Deprecated
public JensenShannonDivergenceDistanceFunction()
Deprecated. Use static instance!
Constructor for the Jensen-Shannon divergence.
• ### Method Detail

• #### distance

public double distance(NumberVector v1,
NumberVector v2)
Description copied from interface: PrimitiveDistanceFunction
Computes the distance between two given DatabaseObjects according to this distance function.
Specified by:
distance in interface NumberVectorDistanceFunction<NumberVector>
Specified by:
distance in interface PrimitiveDistanceFunction<NumberVector>
Overrides:
distance in class JeffreyDivergenceDistanceFunction
Parameters:
v1 - first DatabaseObject
v2 - 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: SpatialPrimitiveDistanceFunction
Computes the distance between the two given MBRs according to this distance function.
Specified by:
minDist in interface SpatialPrimitiveDistanceFunction<NumberVector>
Overrides:
minDist in class JeffreyDivergenceDistanceFunction
Parameters:
mbr1 - the first MBR object
mbr2 - the second MBR object
Returns:
the distance between the two given MBRs according to this distance function
• #### toString

public java.lang.String toString()
Overrides:
toString in class JeffreyDivergenceDistanceFunction