troutpy.tl.compute_js_divergence

troutpy.tl.compute_js_divergence#

troutpy.tl.compute_js_divergence(P, Q, eps=1e-10)#

Compute the Jensen-Shannon divergence between two probability distributions.

Parameters:
  • P (ndarray) – First probability distribution.

  • Q (ndarray) – Second probability distribution, same shape as P.

  • eps (float (default: 1e-10)) – Small constant added to P and Q to avoid division by zero.

Return type:

float

Returns:

The Jensen-Shannon divergence between P and Q.