Facebook Prophet for forecasting a time series with certain values = 0

242 Views Asked by At

I am new with time series forecasting using Prophet. Right now I am facing some issues with an hourly time series that starts at the 1st of June 2022 and ends at the 30th of September 2023 (energy consumpion data). The problem is that during the spring/summer/autumn months (so from April till the end of November) of every year I already know that the energy values are = 0. So the "only" energy values different from 0 are the ones from Dicember 2022 to the end of March 2023. My goal is to predict the energy values for the period Dicember 2023-March 2024. This time series shows weekly and daily seasonality (higher during the weekend and during night hours).

At first I created a 10 months prediction (7200 hours) as below, but this model doesn't include the fact that the energy values are = 0 from April untill the end of November. I thought that I could include this information by adding a holiday component but the holiday effect is fit to be a constant offset, it doesn't set values exactly equal to 0. Anyway with this basic model the prediction is not perfect but it makes sense and it seems to catch the overall trend/seasonal components.

m = Prophet()
m.add_seasonality(name='daily', period = 1, fourier_order=10)
m.add_seasonality(name='weekly', period = 7, fourier_order=4)
m.add_seasonality(name='yearly', period = 365, fourier_order=7)
m.fit(train_ph)

future = m.make_future_dataframe(periods=7200, freq='H') 
prev_prophet = m.predict(future)
prev_prophet['yhat'] = prev_prophet['yhat'].clip(lower=0)

A second approch that I have tried is removing from the trainset the values = 0 (since I already know that enev in the following years they will always be = 0 during those spring/summer/autumn months) and just considering the period from December 2022 untill the end of March 2023. I have tried to make a forecast 12 months ahead and a forecast just for the period of my interest (Dicember 2023-March 2024). By doing so the predictions are completely offset and they don't make any sense.

Do you know what I am doing wrong? How would you handle this time series with this particular characteristics? Do you have any suggestions about how to improve the first model that I created (the one with all the values where I didnt remove any observation)?

Thank you very much!

0

There are 0 best solutions below