All problems
Feature Drift KS Statistic
Problem
Compute the two-sample Kolmogorov-Smirnov statistic between raw reference and current feature values. Evaluate the empirical CDF gap at every distinct value from both samples and return the maximum absolute difference. Return 0.0 when either sample is empty.
Hint
The KS statistic is the largest vertical gap between the two empirical CDFs.
Test cases
case 1
in: [[1,2,3,4],[1,2,3,5]]
expected: 0.25
case 2
in: [[1,2,3],[4,5,6]]
expected: 1
case 3
in: [[1,2,3],[1,2,3]]
expected: 0
case 4
in: [[1,2],[2,3]]
expected: 0.5
case 5
in: [[],[]]
expected: 0
Starter codePython
def feature_drift_ks(reference, current):
# Your code here
pass5 test cases · run your code against them in the editor