def calcKLdivergence_discrete(P1, P2, axis=1):
  KL = np.log(P1 + 1e-100) - np.log(P2 + 1e-100)
  KL *= P1
  KL = KL.sum(axis=axis)
  return KL
dataset/ETHPy150Open daeilkim/refinery/refinery/bnpy/bnpy-dev/bnpy/learnalg/BirthMoveTopicModel.py/calcKLdivergence_discrete/original