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.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-05-26 11:00:00 +0000
Seen: 10 times
Last updated: Jun 11 '21
How to add a Facebook business administrator using Graph API Explorer?
How to direct users to a specific URL after they log in with Facebook?
How to retrieve lost messages in ZeroMQ publish/subscribe model?
How can weights be duplicated and altered using pytorch?
What are the steps to visualize a PCL Model accurately using ROS RVIZ?
What could be the reason for the low AUC and ROC scores of my significant model?
What is the process of using a Word2Vec model on a column within a Pandas dataframe?