Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Weekly Naive model used on series < 7 samples #202

Open
capelastegui opened this issue Mar 25, 2021 · 1 comment
Open

Error: Weekly Naive model used on series < 7 samples #202

capelastegui opened this issue Mar 25, 2021 · 1 comment

Comments

@capelastegui
Copy link
Contributor

On #195 , we introduced auto detection of appropriate naive models. Unfortunately, this breaks for series without a full week worth of samples - a weekly naive model is used instead of the correct regular naive model.

@capelastegui
Copy link
Contributor Author

Solution - In forecast_models.py:

  • create new function, _can_use_season_weekly(), based on line 1949:
    use_season_weekly = (
        # Need more than a full week
        (max_date_delta > pd.Timedelta(min_periods * 7, unit='d')) &
        # Need at least daily samples
        (min_date_delta <= pd.Timedelta(1, unit='d'))
    )
  • Replace the naive model selection code from:
        l_model_naive = [forecast_models.model_snaive_wday] if freq == 'D' \
            else [forecast_models.model_naive]

to:

l_model_naive = [forecast_models.model_snaive_wday] if _use_season_weekly(df_y) \
            else [forecast_models.model_naive]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant