Skip to content

Commit 7be1228

Browse files
authored
Remove max from the Kuiper statistic (#1690)
* Remove max from the Kuiper statistic The reference implementation of uses max() only for the Kolmogorov-Smirnov statistic; the Kuiper statistic is the difference between the max and the min. https://github.com/denismr/incremental-ks/blob/c6bc98833db67d9dc90a0f997a11877860966337/IncrementalKS/Pure%20Python/IKS.py#L55 * Add a changelog entry
1 parent 79d476f commit 7be1228

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

docs/releases/unreleased.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
## stats
44

55
- Added `update_many` method to `stats.PearsonCorr`.
6+
- Changed the calculation of the Kuiper statistic in `base.KolmogorovSmirnov` to correspond to the reference implementation. The Kuiper statistic uses the difference between the maximum value and the minimum value.

river/stats/kolmogorov_smirnov.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def get(self):
270270
if self.statistic == "ks":
271271
return max(self.treap.max_value, -self.treap.min_value) / self.n_samples
272272
elif self.statistic == "kuiper":
273-
return max(self.treap.max_value - self.treap.min_value) / self.n_samples
273+
return (self.treap.max_value - self.treap.min_value) / self.n_samples
274274
else:
275275
raise ValueError(f"Unknown statistic {self.statistic}, expected one of: ks, kuiper")
276276

0 commit comments

Comments
 (0)