You can quickly build time series forecasting models with the Prophet algorithm and visualize the insights including forecasted values, seasonality, trend, and effects.
There are a few blog posts about the Time Series Forecasting with Prophet.
Input data should be a time series data. Each row should represent one observation with date/time. It should have the following columns.
Date/Time Column - A Date or POSIXct column to indicate when the observations were made.
Value Column - A Numeric column that stores observed values.
External Predictors - Optional. If specified, forecast is made based on those columns, in addition to the trend and seasonality seen in the Value Column.
Holiday Column - A categorical column that indicates type of holiday for the day of the observation. When logical column is selected, TRUE means it is a holiday and FALSE means it is not.
There are many properties to configure how to build the models and how to transform the data before passing it to the algorithm.
Forecasting Time Period - Length of periods (e.g. days, months, years...) to forecast.
Uncertainty Interval - Controls the width of displayed uncertainty intervals. The default is 0.8. Probability which is covered by uncertainty interval.
Simulations for Uncertainty Interval - Number of simulations to estimate uncertainty interval.
Yearly Seasonality - By default, whether to use yearly seasonality is automatically determined, but you can explicitly specify it here.
Weekly Seasonality - By default, whether to use weekly seasonality is automatically determined, but you can explicitly specify it here.
Daily Seasonality - By default, whether to use weekly seasonality is automatically determined, but you can explicitly specify it here.
Strength of Seasonality - Controls the strength of seasonality taken into account in the forecasting.
Seasonality Mode - This option controls whether the Seasonality, Holiday, and External Predictors have additive or multiplicative effect in the forecasting. Default is Additive.
Strength of Holiday Effect - Controls the strength of holiday effect taken into account in the forecasting.
Use Built-in Country Holiday Data - By setting this option to Yes, you can specify list of country codes whose holiday data should be considered in making forecast.
Country for Holiday Data - Specify list of country codes here. For supported countries, take a look at this table.
Trend Upper Limit - Upper Limit of trend. Largest possible value for the trend to be forecasted. e.g. Size of entire market, etc.
Trend Lower Limit - Lower limit of trend. Takes effect only when Trend Upper Limit is specified.
Changepoint Period (Ratio) - Change points are detected only within specified ratio of training period from the beginning of data. Default is 0.8, which means change points are detected only within the first 80% period of the training data.
Number of Potential Changepoints - Number of automatically selected candidates for changepoints. Used when Potential Changepoints are not specified.
Flexibility of Changepoint Selection - Larger value makes the trend line more flexible, by allowing more changepoints.
Potential Changepoints - You can specify points of time at which trend could have changed, as candidates of changepoints.
MCMC Samples for Full Bayes - If a value greater than 0 is set, full Bayesian inference with the specified number of MCMC samples is performed. If 0, which is the default, is set, MAP estimation is performed instead of full Bayesian inference.
Missing Value Handling for Value - How to fill missing values after aggregation of data. There are following options. The default is No Fill.
Fill with Previous Value
Fill with Zero
Missing Value Handling for Predictors - How to fill missing values of External Predictors after aggregation. Options are same as "Missing Value Handling for Value".
Test Mode - When this option is set to TRUE, the last part of the input data for the period specified by "Forecasting Time Period" is not used for training data, and kept to test predictive performance of the model.
Time Period for Test Data - Length of periods (e.g. days, months, years...) at the end of the data to be kept as test data.
Under Analytics view, select "Time Series Forecasting (Prophet)" for Analytics Type.
Select a column for Date and select an appropriate scale (e.g. Floor to Week).
(Optional) Select a column and aggregate function for Y Axis. The default is Number of Rows.
(Optional) Select columns and aggregate functions External Predictors.
(Optional) Select a column for Holiday Column.
(Optional) Select a column to group subjects with "Repeat By" column selector. For each group, a separate small chart will be displayed.
Click Run button to run the analytics.
Select each view type (explained below) see the detail of the analysis.
"Forecasted" View displays how the future values look like. with a line chart. Blue line is for actual values and orange line is for forecasted values. Orange band shows uncertainty interval.
"Trend" View displays actual values (blue line), and trend line (orange line). It also displays change points of the trend line, and how much change of slope was made at each change point (green bars).
"Yearly" View displays yearly seasonality.
"Weekly" View displays weekly seasonality, when time unit is DAY or smaller.
"Daily" View displays daily seasonality, when time unit is HOUR or smaller.
"Effects" displays decomposition of forecasted value into trend, seasonalities, holiday effects, and effects of external predictors.
"Data" View shows a table with both past data and forecasted data.
You can enable 'Test Mode' to evaluate the forecasting model. This will split the data into Training and Test periods, build a model based on the training data and evaluate the forecasted values against the test data.
You can enable it from the property.
Take a look at this note for more details on how the evaluation method works.
The dark blue line is the actual data in the training period, and the light blue line is the actual data in the test period. You can compare the orange line with the light blue line to see how close the forecasted values are against the actual values.
There are several metrics to help you evaluate the forecasting model's performance. They are presented under "Summary" tab.
RMSE (Root Mean Square Error) : Root of mean of squares of difference between actual value and forecasted value.
MAE (Mean Absolute Error) : Mean of absolute differences between actual value and forecasted value.
MAPE (Mean Absolute Percentage Error) : Mean of absolute differences in percentage of actual value.
MASE (Mean Absolute Scaled Error)
Take a look at this note for more details on each metric.
Following is the list of country codes that are supported for "Countries or Holidays" property.
Time Series Forecasting view uses the Prophet R Package under the hood.
For details about
prophet usage in Exploratory R Package, please refer to the github repository