Implement the two-sample KS statistic to detect distribution drift between a reference dataset and a current production dataset.
Signature: def ks_statistic(reference: list, current: list) -> float
The KS statistic is the maximum absolute difference between the empirical CDFs of the two samples evaluated over their combined sorted points.
Example:
[1, 2, 3, 4, 5][3, 4, 5, 6, 7]0.4 (max gap between empirical CDFs)Math
Asked at
import numpy as np
def ks_statistic(...):
pass
Premium problem
Free accounts include problems #1–20. Upgrade to unlock the editor, hidden test cases, and reference solutions for every problem.
Already premium?