facebook / facebook/prophet

Can't seem to forecast values correctly for future dates (few values are coming zero and few are not matching the historical pattern)

Open
#2,536 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
20.4k
Forks
4.6k
Avg merge
19h 52m
Merged PRs (30d)
1

Description

Hi,
I am struggling to forecast correctly using prophet in python.
I have weekly finance data for 1 year starting 2022-11-27 and ending in 2023-11-19 and I am trying to predict for next year.
I am struggling to match the pattern exhibited in the input data during December 2022 in the forecasted data.
I have tried to play with the order of the fourier series for custom monthly seasonalities.

I am considering three seasonalities for my data. From 2022-11-27 till 2022-12-25, there is a downward trend. From 2023-09-24 till 2023-11-19 the data seems to show higher values. For rest of the data, there is regular peak and trough in each month. I am attaching the forecast plot of the data. My code looks as shown below
```

g_sn= partial(weeks_between, 38,46)
f_sn= partial(weeks_between, 47,52)
o_sn= partial(weeks_between, 1,37)

m.add_seasonality(name='monthly_off', period= 30.5, fourier_order=8, condition_name="o_sn")
m.add_seasonality(name='monthly_growth', period= 30.5, fourier_order=8, condition_name="g_sn")
m.add_seasonality(name='monthly_fall', period= 30.5, fourier_order=8, condition_name="f_sn")
inp['o_sn'] = inp['ds'].apply(o_sn)
inp['g_sn'] = inp['ds'].apply(g_sn)
inp['f_sn'] = inp['ds'].apply(f_sn)
```

![data_test](https://github.com/facebook/prophet/assets/15104152/0f8ba50b-32ee-4337-8524-713e579b1fb3)

For two future week start dates 2023-12-10 and 2023-12-17, I am getting 0 as forecast value (marked in red in the above picture). Infact the forecast for the initial weeks of 2024 January are also not following the previous pattern in input data. After that, I am getting proper forecasted values. What am I doing wrong with prophet ?

I am also attaching my model plot components for reference.

![m_components](https://github.com/facebook/prophet/assets/15104152/887fbae2-ea9b-48bc-aa0d-954295b14089)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.