The seasonality component in the forecast for the training data differs from that in the future predictions
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Domain
- data, machine-learning
Research direction
Start by reproducing the supplied single_prophet example, focusing on the two model.predict calls and the weekly outputs plotted for historical and future dates. The issue does not include the input data, so compare the seasonal components only after obtaining a complete reproducer; done means explaining or fixing any confirmed difference and validating the result in both plots.
Written by the indexing model from the issue text.
Description
Hi!
I have encountered an issue while using Facebook Prophet for time series forecasting. The seasonal component included in the forecast for the training data appears to be different from the seasonal component applied when making future predictions. Specifically, the weekly seasonality pattern observed in historical data does not seem to be reflected consistently in the forecasted values for the future.
Ultimately, due to this issue, the forecast for the future appears unrealistic in terms of weekly seasonality. I have not been able to find an explanation for this behavior myself. I would greatly appreciate any explanation from knowledgeable professionals.
Below, I have included a code snippet and a visualization to illustrate the issue. Thank you!
def single_prophet(df, train_dates, seasonality_mode='additive'):
df = df.copy()
df['ds'] = pd.to_datetime(df['ds'])
df = df.sort_values('ds')
future_pred_dates = pd.DataFrame(pd.date_range(start=pd.Timestamp.now(), end=pd.Timestamp('2025-12-31'), freq='D'), columns=['ds'])
model = Prophet(seasonality_mode=seasonality_mode) # , holidays=holidays, holidays_prior_scale=1
model.fit(df[df['ds'] >= train_dates[0]])
fact_pred = model.predict(df[df['ds'] >= train_dates[0]][['ds']])
future_pred = model.predict(future_pred_dates)
fig = go.Figure()
fig.add_trace(go.Scatter(x=df.ds, y=df['y'], name='fact'))
fig.add_trace(go.Scatter(x=fact_pred.ds, y=fact_pred['yhat'], name='fact_pred'))
fig.add_trace(go.Scatter(x=fact_pred.ds, y=fact_pred['trend'], name='fact_trend'))
fig.add_trace(go.Scatter(x=fact_pred.ds, y=fact_pred['weekly'], name='fact_weekly'))
fig.add_trace(go.Scatter(x=future_pred.ds, y=future_pred['yhat'], name='future_pred'))
fig.add_trace(go.Scatter(x=future_pred.ds, y=future_pred['trend'], name='future_trend'))
fig.add_trace(go.Scatter(x=future_pred.ds, y=future_pred['weekly'], name='future_weekly'))
fig.show()
single_prophet(
data,
train_dates=['2025-02-01', '2025-03-01']
)
- Dominant language
- Python
- Stars
- 20.5k
- Forks
- 4.6k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from facebook/prophet
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Linux x86-64 wheel: overlapping ELF load pages in prophet_model.bin on Linux 4.18 kernelsPossibly taken @nicolasdalsass claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
make_future_dataframe returns 1970 dates when `ds` is an integer columnPossibly taken @k0nnect claimed this 10 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
model_to_json drops the fitted regressor predictor; deserialized model can't predictPossibly taken @caiotheodoro claimed this 11 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
plot_components fails for logistic models with minmax scaling and no floorPossibly taken @RaphaelFakhri claimed this 38 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
All issues in facebook/prophet
Similar issues
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorPossibly taken @jejjohnson claimed this today. Opentype:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jejjohnson/integrix#144 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
finos/ai-governance-framework#459 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freelawproject/litigant-portal#1307 ·
Maintainers usually reply within 2 days
-
type/bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
h2oai/h2o-llmstudio#1163 ·
Maintainers usually reply within 1 day