FORECAST
The FORECAST
commands lets you forecast a time series, given a time and a column to predict.
The command will append many columns to the output - the most important is forecast
,
which is the column we are predicting on.
The underlying model to our forecasting uses Prophet, created by Facebook.
Syntax
FORECAST(<column_name>, [, time=<time_column>, horizon=<horizon>])
column_name
the input column name to forecast on. This must be a numerical input.time
is the column name of the time column. This column must have the format YYYY-MM-DD HH:MM:SS or YYYY-MM-DD.- The default is
ds
. Replace this if your time column is another time.
- The default is
Returns
The command will append many column to the output, described below:
forecast
is the median forecasted value.forecast_upper
is the 90th quantile forecast value.forecast_lower
is the 10th quantile forecast value.trend
is the median trend of the forecast.trend_upper
is the 90th quantile trend of the forecast.trend_lower
is the 10th quantile trend of the forecast.weekly
is the median weekly trend of the forecast.weekly_upper
is the 90th quantile weekly trend of the forecast.weekly_lower
is the 10th quantile weekly trend of the forecast.yearly
is the median yearly trend of the forecast.yearly_upper
is the 90th quantile yearly trend of the forecast.yearly_lower
is the 10th quantile yearly trend of the forecast.
Examples
Forecast the number of bookings in the next year.
SELECT * FROM airbnb FORECAST(total_bookings, time=date, horizon=365)