Skip to content
DeepForgeby svx
All problems
HardStatisticsst-140

Paired t Confidence Interval on CV Folds

Problem

Return the paired confidence interval for the mean difference between model A and model B across cross-validation folds: mean(d) +/- t_crit * sd(d)/sqrt(k) with d = fold_a - fold_b. Return [0.0, 0.0] when fewer than two folds or lengths differ, and [mean(d), mean(d)] when the differences are constant.

Hint

Treat the folds as paired observations and use the supplied t critical value.

Test cases

case 1
in: [[0.9,0.8,0.85,0.87],[0.8,0.75,0.8,0.79],2.353]
expected: [0.0411817531761559,0.09881824682384406]
case 2
in: [[1,2,3],[1,2,3],2]
expected: [0,0]
case 3
in: [[0.5,0.6],[0.4,0.5],12.706]
expected: [0.09999999999999998,0.09999999999999998]
case 4
in: [[1],[2],2]
expected: [0,0]
case 5
in: [[],[],2]
expected: [0,0]
Starter codePython
def paired_ci_cv(fold_a, fold_b, t_crit):
    # Your code here
    pass

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