All problems
Persistence Baseline RMSE
Problem
Compute the RMSE of the persistence (last value) baseline: the square root of the mean squared one-step change (x[t] - x[t-1])^2.
Return 0.0 for a series with fewer than two points. This baseline is the bar every forecasting model must clear.
Hint
Squaring before averaging penalizes large one-step jumps.
Test cases
case 1
in: [[1,3,6,10]]
expected: 3.1091263510296048
case 2
in: [[5,5,5]]
expected: 0
case 3
in: [[10,7,9]]
expected: 2.5495097567963922
case 4
in: [[4]]
expected: 0
Starter codePython
def persistence_baseline_rmse(series):
# Your code here
pass4 test cases · run your code against them in the editor