1 | initial version |
To use Facebook's Prophet model with regressors to make forecasts, you can follow the steps below:
import pandas as pd
from fbprophet import Prophet
df = pd.read_csv('data.csv')
model = Prophet()
model.add_regressor('regressor_1')
model.add_regressor('regressor_2')
model.fit(df)
future_df = model.make_future_dataframe(periods=365)
future_df['regressor_1'] = [1, 2, ..., 5]
future_df['regressor_2'] = [10, 20, ..., 50]
forecast = model.predict(future_df)
model.plot(forecast)
This code assumes that you have a CSV file called 'data.csv' with columns 'ds' (the date column) and 'y' (the target variable column). The regressors are assumed to be called 'regressor1' and 'regressor2'.
You can replace the regressors and target variable columns names with whatever you have in your dataset.
Note that Prophet handles missing values automatically, so you don't need to worry about that as long as your dataset is reasonably complete.