topsoe#

mlquantify.utils.method.topsoe(dist1, dist2)[source]#

Compute the Topsøe distance between two probability distributions.

The Topsøe distance is a measure of divergence between two probability distributions. It is defined as:

D(P, Q) = Σ(Pᵢ * log(2 * Pᵢ / (Pᵢ + Qᵢ)) + Qᵢ * log(2 * Qᵢ / (Pᵢ + Qᵢ)))

Parameters:
dist1array-like

The first probability distribution ( P ), where each element ( Pᵢ ) represents the probability of the ( i )-th event.

dist2array-like

The second probability distribution ( Q ), where each element ( Qᵢ ) represents the probability of the ( i )-th event.

Returns:
float

The Topsøe distance between the two distributions.

Notes

  • This distance is non-negative and equals zero if and only if the two distributions are identical.

  • Both input distributions must be valid probability distributions; their elements should be non-negative and sum to 1.

  • Division by zero is avoided by assuming the input distributions have no zero elements.

  • The logarithm used is the natural logarithm.