Skip to content

Commit

Permalink
Merge f5d37b5 into 89c4ecc
Browse files Browse the repository at this point in the history
  • Loading branch information
FelipeAdachi committed Mar 22, 2022
2 parents 89c4ecc + f5d37b5 commit 5f63be0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/whylogs/core/summaryconverters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
kll_floats_sketch,
update_theta_sketch,
)
from scipy import special, stats
from scipy import stats

from whylogs.proto import (
ColumnSummary,
Expand Down Expand Up @@ -289,8 +289,11 @@ def ks_test_compute_p_value(target_distribution: kll_floats_sketch, reference_di
D_max = D
j += 1

n_samples = min(target_distribution.get_n(), reference_distribution.get_n())
p_value = special.kolmogorov(np.sqrt(n_samples) * D_max)
m, n = sorted([target_distribution.get_n(), reference_distribution.get_n()], reverse=True)
en = m * n / (m + n)

p_value = stats.distributions.kstwo.sf(D_max, np.round(en))

return type("Object", (), {"ks_test": p_value})


Expand Down

0 comments on commit 5f63be0

Please sign in to comment.