Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-227

Seasonal Naive Baseline MSE

Problem

Compute the MSE of the seasonal naive baseline: the mean of (x[t] - x[t-m])^2 over t >= m.

Return 0.0 if season_length is not positive or the series is not longer than one season.

Hint

A perfectly repeating seasonal pattern gives zero baseline error.

Test cases

case 1
in: [[1,2,3,4,5,6],2]
expected: 4
case 2
in: [[2,4,6,8],2]
expected: 16
case 3
in: [[1,2,3],5]
expected: 0
case 4
in: [[10,20,10,20],2]
expected: 0
Starter codePython
def seasonal_naive_baseline_mse(series, season_length):
    # Your code here
    pass

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