Prophet Forecasting

Question:

My dataframe is in weekly level as below:
sample

was trying to implement prophet model using the below code.

df.columns = ['ds', 'y']
# define the model
model = Prophet(seasonality_mode='multiplicative')
# fit the model
model1=model.fit(df)

model1.predict(10)

I need to predict the output in a weekly level for the next 10 weeks.How can I fix this?

I need to predict the output in a weekly level for the next 10 weeks.How can I fix this?

Asked By: Unicorn

||

Answers:

You need to use model.make_future_dataframe to create new dates:

model = Prophet()
model.fit(df)

future = model.make_future_dataframe(periods=10)

predictions = model.predict(future)

predictions will give predicted values for the whole dataframe, you can reach to the forecasted values for the next 10 weeks with simple indexing:

future_preds = predictions.iloc[-10:]
Answered By: Nuri Taş
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.