smoothing the prevalences in kld error function, bugfix

This commit is contained in:
Alejandro Moreo Fernandez 2024-05-08 11:31:56 +02:00
parent 817aab1d99
commit 4db21b6945
1 changed files with 2 additions and 2 deletions

View File

@ -158,8 +158,8 @@ def kld(prevs, prevs_hat, eps=None):
:return: Kullback-Leibler divergence between the two distributions
"""
eps = __check_eps(eps)
smooth_prevs = prevs + eps
smooth_prevs_hat = prevs_hat + eps
smooth_prevs = smooth(prevs, eps)
smooth_prevs_hat = smooth(prevs_hat, eps)
return (smooth_prevs*np.log(smooth_prevs/smooth_prevs_hat)).sum(axis=-1)