Skip to content

Instantly share code, notes, and snippets.

@jonadsimon
Created November 4, 2018 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonadsimon/db42febb02661f23deb4e65333cc64fa to your computer and use it in GitHub Desktop.
Save jonadsimon/db42febb02661f23deb4e65333cc64fa to your computer and use it in GitHub Desktop.
from scipy.stats import entropy
def jensen_shannon_div(p, q):
m = (p + q) / 2
return (entropy(p, m) + entropy(q, m)) / 2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment