Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-275

One-Sample KS Drift Statistic

Problem

Return the one-sample Kolmogorov-Smirnov statistic of data against the Uniform(0, 1) distribution: the maximum of |(i + 1) / n - x_(i)| and |x_(i) - i / n| over sorted values x_(i). Return 0.0 for empty data.

Test cases

case 1
in: [[0.1,0.4,0.35,0.8]]
expected: 0.35
case 2
in: [[0.5,0.5]]
expected: 0.5
case 3
in: [[]]
expected: 0
case 4
in: [[0,1]]
expected: 0.5
Starter codePython
def ks_uniform(data):
    # Your code here
    pass

4 test cases · run your code against them in the editor