Skip to content
DeepForgeby svx
All problems
HardTime Seriests-263

Quantile Loss Multi-Horizon

Problem

Compute the mean pinball loss over multiple horizons and quantiles. actual[t] is compared with forecasts[t][qi] at quantile quantiles[qi]: add q * d when d = actual - forecast >= 0, otherwise (q - 1) * d.

Return the average over all horizon-quantile pairs, or 0.0 for empty inputs.

Hint

Each horizon can use its own quantile grid, which is how multi-horizon quantile models train.

Test cases

case 1
in: [[10,12],[[11,9],[10,13]],[0.5,0.5]]
expected: 0.625
case 2
in: [[5],[[6,4]],[0.1,0.9]]
expected: 0.9
case 3
in: [[1,2,3],[[1,1],[2,2],[3,3]],[0.5]]
expected: 0
case 4
in: [[],[],[0.5]]
expected: 0
Starter codePython
def quantile_loss_multi_horizon(actual, forecasts, quantiles):
    # Your code here
    pass

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