All problems
Intermittent Demand MASE
Problem
Compute MASE for intermittent demand using the mean absolute period-to-period change of the training series as the scale: denominator = mean(|train[t] - train[t-1]|). Return the mean absolute forecast error divided by that denominator.
Return 0.0 when the denominator is zero, train is shorter than two points, or actual is empty.
Hint
The period-to-period scale is robust to long runs of zero demand.
Test cases
case 1
in: [[1,0,2],[1.5,0.5,1.5],[0,0,2,0,2]]
expected: 0.3333333333333333
case 2
in: [[0,0],[1,1],[0,0,0]]
expected: 0
case 3
in: [[5],[5],[1,2]]
expected: 0
case 4
in: [[2,4],[3,3],[1,2,3,4]]
expected: 1
Starter codePython
def intermittent_mase(actual, forecast, train):
# Your code here
pass4 test cases · run your code against them in the editor