Skip to content

Misleading function name: get_seasonality(freq) does not estimate or detect seasonality #3278

@valeman

Description

@valeman

I would like to raise a concern regarding the function:
gluonts.time_feature.seasonality.get_seasonality(freq)

The current name suggests that the function detects, estimates, or otherwise infers seasonality from data.

However, after reviewing the implementation, the function does not analyze any time series. It simply returns a hard-coded calendar heuristic based on the pandas frequency string.

For example:
"H" → returns 24
"15min" → returns 96
"M" → returns 12
"D" → returns 1

There is:
No ACF
No periodogram
No decomposition
No statistical inference of any kind

The function maps frequency aliases to predefined calendar constants and divides by the interval multiple. If the division is not exact, it falls back to 1.

This is not “getting seasonality” in any statistical sense. It is imposing a deterministic convention.

Why this matters

The returned value propagates into:
Seasonal naïve baselines
MASE scaling
Evaluation pipelines
Benchmark comparisons

Because of the function name, users may reasonably assume that some form of data-driven inference is taking place, which is not the case.

The concern is not the heuristic itself — deterministic defaults are often necessary in large-scale systems. The issue is that the naming suggests inference rather than a static rule.

Suggestion
Consider renaming the function to something more explicit, for example:
calendar_default_seasonal_period(freq)
default_seasonality_from_frequency(freq)
heuristic_seasonal_period(freq)

Alternatively, add explicit documentation clarifying that:
The function does not inspect data
The returned value is a calendar-based convention

It should not be interpreted as detected seasonality

Clear naming is especially important in forecasting libraries, where terminology carries strong statistical meaning.
Thank you for considering this clarification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions