Skip to content
DeepForgeby svx
All problems
MediumTime Seriests-163

MASE Seasonal Denominator

Problem

Compute the denominator of a seasonal MASE: the mean absolute seasonal difference mean(|x[t] - x[t-m]|) over t >= m.

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

Hint

This scale comes from the seasonal naive forecast on the training data.

Test cases

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

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