aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/sddm/stats.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/utils/sddm/stats.py b/utils/sddm/stats.py
index 593c888..5324eea 100644
--- a/utils/sddm/stats.py
+++ b/utils/sddm/stats.py
@@ -29,11 +29,7 @@ def nllr(samples,expected):
p_samples /= p_samples.sum(-1)[:,np.newaxis]
p_expected = expected.astype(np.double) + 1e-10
p_expected /= p_expected.sum()
- # For some reason multinomial.logpmf([0,0,...],0,p) returns nan
- mask = n == 0
- rv = poisson.logpmf(n,N) - poisson.logpmf(n,n)
- rv[~mask] += multinomial.logpmf(samples[~mask],n[~mask],p_expected) - multinomial.logpmf(samples[~mask],n[~mask],p_samples[~mask])
- return -2*rv.squeeze()[()]
+ return 2*(N - n + (samples*np.log(np.where(samples == 0,1,samples)/expected)).sum(axis=-1)).squeeze()[()]
def get_mc_hist_posterior(hist, data, norm):
"""