Saving a model
In Chapter 10, Uncertainty Intervals, you forecasted the number of crimes per day in the city of Baltimore, using Markov chain Monte Carlo (MCMC) sampling. This was a long computation, and you were only using daily data. Had you used the Divvy hourly data instead, a dataset more than 10 times larger, the computation would have been even longer. And these two datasets are certainly smaller than many you'll encounter in the real world. If Prophet provided no way to save your work, every time you trained a model, you would have to leave the model in your computer's memory for as long as you wanted to use it.
Maybe you're familiar with the pickle
module in Python—this works great to save your trained models in sklearn
, for example. However, Prophet uses Stan in the backend to build its models and these Stan objects don't pickle well. Fortunately, Prophet includes some functions to serialize your model in JSON and re-open it later. So, once your...