diff --git a/river/stats/kolmogorov_smirnov.py b/river/stats/kolmogorov_smirnov.py index 873e3dd731..e3689a9613 100644 --- a/river/stats/kolmogorov_smirnov.py +++ b/river/stats/kolmogorov_smirnov.py @@ -226,14 +226,6 @@ def __init__(self, statistic="ks"): self.n_samples = 0 self.statistic = statistic - @staticmethod - def ca(p_value): - return (-0.5 * math.log(p_value)) ** 0.5 - - @classmethod - def ks_threshold(cls, p_value, n_samples): - return cls.ca(p_value) * (2.0 * n_samples / n_samples**2) - def update(self, x, y): keys = ((x, 0), (y, 1)) @@ -282,7 +274,11 @@ def get(self): else: raise ValueError(f"Unknown statistic {self.statistic}, expected one of: ks, kuiper") - def test_ks_threshold(self, ca): + @staticmethod + def _ca(p_value): + return (-0.5 * math.log(p_value)) ** 0.5 + + def _test_ks_threshold(self, ca): """ Test whether the reference and sliding window follows the same or different probability distribution. This test will return `True` if we **reject** the null hypothesis that diff --git a/river/stats/test_ks.py b/river/stats/test_kolmogorov_smirnov.py similarity index 93% rename from river/stats/test_ks.py rename to river/stats/test_kolmogorov_smirnov.py index baa979189e..24b2fd4f97 100644 --- a/river/stats/test_ks.py +++ b/river/stats/test_kolmogorov_smirnov.py @@ -42,4 +42,4 @@ def test_incremental_ks_statistics(): assert np.allclose(np.array(incremental_ks_statistics), np.array(ks_2samp_statistics)) - assert incremental_ks.test_ks_threshold(ca=incremental_ks.ca(p_value=0.05)) is True + assert incremental_ks._test_ks_threshold(ca=incremental_ks._ca(p_value=0.05)) is True