Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-012

Root Mean Squared Error of Forecasts

Problem

Compute the root mean squared error between actual values and forecasts: sqrt((1/n) * sum((actual[t] - forecast[t])^2)).

Return 0.0 when the actual list is empty.

Hint

Square the errors, average, then take the square root. Large errors dominate.

Test cases

case 1
in: [[10,12,14],[11,11,11]]
expected: 1.9148542155126762
case 2
in: [[0,0],[3,4]]
expected: 3.5355339059327378
case 3
in: [[1,2],[1,2]]
expected: 0
Starter codePython
def root_mean_squared_error(actual, forecast):
    # Your code here
    pass

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