Warn when yearly seasonality is forced on with insufficient history (#2709)#2736
Warn when yearly seasonality is forced on with insufficient history (#2709)#2736anp-exe wants to merge 1 commit into
Conversation
|
Hi @anp-exe! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Fixes #2709.
When
yearly_seasonality=Trueis set explicitly on under ~2 years of data, the yearly component is under-identified and the trend/seasonality split becomes unstable across Prophet/Stan versions (the linked issue shows the same data producing +2.9M vs -12.4M forecasts depending on environment).The instability itself is fundamental to the math, so this doesn't try to "fix" the forecasts. Instead it adds the safeguard the reporter asked for: a
logger.warninginset_auto_seasonalities()when yearly seasonality is forced on with insufficient history, so users get a clear heads-up rather than unstable output.The warning fires only when seasonality is forced on with under 730 days of data. It stays silent on
'auto'(which already disables yearly seasonality with its own info-level message) and when there are >= 2 years of data.Includes two tests in
test_prophet.pycovering both the warning case and the no-warning-on-auto case.