Skip to content
DeepForgeby svx
All problems
MediumTime Seriests-164

Relative Absolute Error to Naive

Problem

Compute the relative absolute error against a naive forecast: sum(|actual - forecast|) / sum(|actual - naive|).

Return 0.0 when the naive denominator is zero.

Hint

Values below 1 mean the forecast beats the naive benchmark.

Test cases

case 1
in: [[10,12,14],[11,11,11],[10,10,10]]
expected: 0.8333333333333334
case 2
in: [[1,2,3],[2,2,2],[1,1,1]]
expected: 0.6666666666666666
case 3
in: [[5,5],[5,5],[5,5]]
expected: 0
case 4
in: [[1,2],[3,2],[0,2]]
expected: 2
Starter codePython
def relative_absolute_error_naive(actual, forecast, naive):
    # Your code here
    pass

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