Time Series Forecasting (Prophet)
Time Series Forecasting
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
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.
Properties
There are many properties to configure how to build the models and how to transform the data before passing it to the algorithm.
Analytics Properties
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.
Seasonalities
Yearly Seasonality - By default, whether to use yearly seasonality is automatically determined, but you can explicitly specify it here.
Quarterly Seasonality - By default, it is not used.
Monthly Seasonality - By default, it is not used.
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.
Holidays
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.
Limits
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.
Changepoints
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.
Other Properties
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.
Data Preprocessing
Missing Value Handling for Value - How to fill missing values after aggregation of data. There are following options. The default is No Fill.
No Fill
Fill with Previous Value
Fill with Zero
Linear Interpolation
Spline Interpolation
Missing Value Handling for Predictors - How to fill missing values of External Predictors after aggregation. Options are same as "Missing Value Handling for Value".
Evaluation
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.
How to Use This Feature
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
"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.
You can check "Autoscale Y Axis" checkbox to make the Y axis scale optimized.
"Trend" View
"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).
You can check "Autoscale Y Axis" checkbox to make the Y axis scale optimized.
"Yearly" View
"Yearly" View displays yearly seasonality.
"Weekly" View
"Weekly" View displays weekly seasonality, when time unit is DAY or smaller.
"Daily" View
"Daily" View displays daily seasonality, when time unit is HOUR or smaller.
"Effects" View
"Data" View
Evaluation of Forecasting Models
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.
"Forecasted" View in Test Mode
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.
"Summary" View in Test Mode
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.
Countries for Holidays
Following is the list of country codes that are supported for "Countries or Holidays" property.
Code | Country Name |
AR | Argentina |
AT | Austria |
AU | Australia |
BD | Bangladesh |
BE | Belgium |
BR | Brazil |
BY | Belarus |
CA | Canada |
CH | Switzerland |
CN | China |
CO | Colombia |
CZ | Czechia |
DE | Germany |
DK | Denmark |
EG | Egypt |
ES | Spain |
FI | Finland |
FR | France |
GB | United Kingdom |
HR | Croatia |
HU | Hungary |
ID | Indonesia |
IE | Ireland |
IN | India |
IT | Italy |
JP | Japan |
MX | Mexico |
MY | Malaysia |
NL | Netherlands |
NO | Norway |
NZ | New Zealand |
PH | Philippines |
PK | Pakistan |
PL | Poland |
PT | Portugal |
RU | Russia |
SE | Sweden |
SI | Slovenia |
SK | Slovakia |
TH | Thailand |
TR | Turkey |
UA | Ukraine |
US | United States |
VN | Vietnam |
ZA | South Africa |
R Package
Time Series Forecasting view uses the Prophet R Package under the hood.
Exploratory R Package
For details about prophet
usage in Exploratory R Package, please refer to the github repository
Last updated