Unicorn
Unicorn

Reputation: 51

Prophet Forecasting

My dataframe is in weekly level as below:

sample

I was trying to implement a prophet model using this 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?

Upvotes: 3

Views: 576

Answers (1)

Nuri Taş
Nuri Taş

Reputation: 3845

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

model = Prophet()
model.fit(df)

future = model.make_future_dataframe(periods=10, freq='W')

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:]

Upvotes: 4

Related Questions