All problems
Quantile Coverage Rate
Problem
Compute the empirical coverage rate of a quantile forecast: the fraction of actual values less than or equal to the matching forecast, that is the share of observations in which the quantile was not exceeded.
Return 0.0 for empty input.
Hint
A calibrated 0.9 quantile forecast should be exceeded only about one time in ten.
Test cases
case 1
in: [[10,12,14],[11,11,11]]
expected: 0.3333333333333333
case 2
in: [[5,5],[5,5]]
expected: 1
case 3
in: [[1,2,3],[3,3,3]]
expected: 1
case 4
in: [[],[]]
expected: 0
case 5
in: [[4,5,6],[4,5,5.5]]
expected: 0.6666666666666666
Starter codePython
def quantile_coverage_rate(actual, forecast):
# Your code here
pass5 test cases · run your code against them in the editor