Creating the Prophet performance metrics DataFrame
Now that you've learned what the different options are for performance metrics in Prophet, let's start coding and see how to access these. We'll use the same online retail sales data we used in Chapter 11, Cross-Validation. Along with our usual imports, we are going to add the performance_metrics
function from Prophet's diagnostics
package and the plot_cross_validation_metric
function from the plot
package:
import pandas as pd import matplotlib.pyplot as plt from fbprophet import Prophet from fbprophet.plot import add_changepoints_to_plot from fbprophet.diagnostics import cross_validation from fbprophet.diagnostics import performance_metrics from fbprophet.plot import plot_cross_validation_metric
Next, let's load the data, create our forecast, and plot the results:
df = pd.read_csv('online_retail.csv') df.columns = ['ds', 'y'] model = Prophet(yearly_seasonality=4) model...