All problems
Peak Magnitude Error
Problem
Compute the peak magnitude error as max(forecast) - max(actual).
Return 0.0 if either series is empty.
Hint
Positive values mean the forecast overshoots the observed peak.
Test cases
case 1
in: [[1,5,3],[1,2,6]]
expected: 1
case 2
in: [[3,1,2],[2,1,3]]
expected: 0
case 3
in: [[1,2],[5,8]]
expected: 6
case 4
in: [[],[]]
expected: 0
Starter codePython
def peak_magnitude_error(actual, forecast):
# Your code here
pass4 test cases · run your code against them in the editor