All problems
Prediction Interval Coverage
Problem
Compute the fraction of observations inside their prediction intervals [lower, upper] (inclusive).
Empty input returns 0.0.
Hint
Empirical coverage should roughly match the nominal confidence level.
Test cases
case 1
in: [[[0,1],[2,3]],[0.5,2.5]]
expected: 1
case 2
in: [[[0,1],[2,3]],[0.5,4]]
expected: 0.5
case 3
in: [[[0,1]],[1.5]]
expected: 0
case 4
in: [[],[]]
expected: 0
Starter codePython
def interval_coverage(intervals, y_true):
# Your code here
pass4 test cases · run your code against them in the editor