All problems
Naive Forecast MAE
Problem
Evaluate the one-step naive forecast on the last h observations of a series, where the forecast for each point is simply the previous observation. Return the mean absolute error over those h steps.
Return 0.0 when h is not positive or when h is larger than the number of available one-step errors, n - 1.
Hint
Each error is just the absolute change between consecutive observations.
Test cases
case 1
in: [[1,2,4,7],3]
expected: 2
case 2
in: [[5,5,5],2]
expected: 0
case 3
in: [[1,2],1]
expected: 1
case 4
in: [[1,2,3],5]
expected: 0
Starter codePython
def naive_holdout_mae(series, h):
# Your code here
pass4 test cases · run your code against them in the editor