Adding continuous regressors
In this example, we will take everything from the previous example and simply add in one more regressor for temperature. Let's begin by looking at the temperature data:
There's nothing too surprising about the preceding plot; daily temperatures rise in summer and fall in winter. It does look a lot like Figure 4.6 from Chapter 4, Seasonality, but without that increasing trend. Clearly, Divvy ridership and the temperature rise and fall together.
Adding temperature, a continuous variable, is no different than adding binary variables. We simply add another add_regressor
call to our Prophet instance, specifying 'temp'
for the name, and also including the temperature forecast in our future
DataFrame. As we did before, we are fitting our model on the train
DataFrame we created, which excludes the final 2 weeks' worth of data. Finally, we plot the components to...