def KLDivergenceSim(a,b,topics):
from scipy.stats import entropy
import math
a = fill_list_from_dict(a,topics)
b = fill_list_from_dict(b,topics)
entropyOf_A_to_B = entropy(a,b)
entropyOf_B_to_A = entropy(b,a)
minusSummedEntropy = -(entropyOf_A_to_B+entropyOf_B_to_A)
return math.exp(minusSummedEntropy)
评论列表
文章目录