Nested (Iterative) Forecasting is aimed at making it easier to perform forecasting that is traditionally done in a for-loop with models like ARIMA, Prophet, and Exponential Smoothing. Functionality has been added to:
modeltime_nested_fit(): Fits many models to nested time series data and organizes in a “Nested Modeltime Table”. Logs Accuracy, Errors, and Test Forecasts.
control_nested_fit(): Used to control the fitting process including verbosity and parallel processing.
modeltime_nested_refit(): Refits to the
.future_data. Logs Future Forecasts.
control_nested_refit(): Used to control the re-fitting process including verbosity and parallel processing.
Logging Extractors: Functions that retrieve logged information from the re-fitting process.
modeltime_fit_workflowset(): Improved handling of Workflowset Descriptions, which now match the
We’ve expanded Panel Data functionality to produce model accuracy and confidence interval estimates by a Time Series ID (#114). This is useful when you have a Global Model that produces forecasts for more than one time series. You can more easily obtain grouped accuracy and confidence interval estimates.
modeltime_calibrate(): Gains an
id argument that is a quoted column name. This identifies that the residuals should be tracked by an time series identifier feature that indicates the time series groups.
modeltime_accuracy(): Gains a
acc_by_id argument that is
FALSE. If the data has been calibrated with
id, then the user can return local model accuracy by the identifier column. The accuracy data frame will return a row for each combination of Model ID and Time Series ID.
modeltime_forecast(): Gains a
conf_by_id argument that is
FALSE. If the data has been calibrated with
id, then the user can return local model confidence by the identifier column. The forecast data frame will return an extra column indicating the identifier column. The confidence intervals will be adjusted based on the local time series ID variance instead of the global model variance.
New Vignette: Parallel Processing
cores > cores_available.
exp_smoothing() gained 3 new tunable parameters:
smooth_level(): This is often called the “alpha” parameter used as the base level smoothing factor for exponential smoothing models.
smooth_trend(): This is often called the “beta” parameter used as the trend smoothing factor for exponential smoothing models.
smooth_seasonal(): This is often called the “gamma” parameter used as the seasonal smoothing factor for exponential smoothing models.
recursive()for ensembles. The new recursive ensemble functionality is in
window_reg: Window-based methods such as mean, median, and even more complex seasonal models based on a forecasting window. The main tuning parameter is
naive_reg: NAIVE and Seasonal NAIVE (SNAIVE) Regression Models
recursive(): Turn a fitted model into a recursive predictor. (#49, #50)
update_modeltime_model(): New function to update a modeltime model inside a Modeltime Table.
as_modeltime_table(): New function to convert one or more fitted models stored in a
list to a Modeltime Table.
m750_models: Fixes error “R parsnip Error: Internal error: Unknown
keep_data: Gains a new argument
keep_data. This is useful when the
actual_datahas important information needed in analyzing the forecast.
arrange_index: Gains a new argument
arrange_index. By default, the forecast keeps the rows in the same order as the incoming data. Prior versions arranged Model Predictions by
.index, which impacts the users ability to match to Panel Data which is not likely to be arranged by date. Prediction best-practices are to keep the original order of the data, which will be preserved by default. To get the old behavior, simply toggle
arrange_index = TRUE.
modeltime_calibrate(): Can now handle panel data.
modeltime_accuracy(): Can now handle panel data.
plot_modeltime_forecast(): Can handle panel data provided the data is grouped by an ID column prior to plotting.
modeltime_calibrate(quiet = FALSE).
parsnip >= 0.1.4. Uses
modeltime_refit()- Changes to improve fault tolerance and error handling / messaging when making ensembles.
modeltime.ensemble, a new R package designed for forecasting with ensemble models.
New Workflow Helper Functions
add_modeltime_model()- A helper function making it easy to add a fitted parsnip or workflow object to a modeltime table
pull_modeltime_model()- A helper function making it easy to extract a model from a modeltime table
prophet_reg()can now have regressors controlled via
set_engine()using the following parameters:
regressors.mode- Set to
regressors.prior.scale- Set to 10,000 by default.
regressors.standardize- Set to “auto” by default.
Modeltime now includes 4 new data sets:
m750- M750 Time Series Dataset
m750_models- 3 Modeltime Models made on the M750 Dataset
rsplitobject containing Train/test splits of the M750 data
m750_training_resamples- A Time Series Cross Validation
time_series_cvobject made from the
plot_modeltime_forecast()fix issue with “ACTUAL” data being shown at bottom of legend list. Should be first item.
Forecast without Calibration/Refitting
Sometimes it’s important to make fast forecasts without calculating out-of-sample accuracy and refitting (which requires 2 rounds of model training). You can now bypass the
modeltime_refit() steps and jump straight into forecasting the future. Here’s an example with
h = "3 years". Note that you will not get confidence intervals with this approach because calibration data is needed for this.
# Make forecasts without calibration/refitting (No Confidence Intervals) # - This assumes the models have been trained on m750 modeltime_table( model_fit_prophet, model_fit_lm ) %>% modeltime_forecast( h = "3 years", actual_data = m750 ) %>% plot_modeltime_forecast(.conf_interval_show = F)
Residual Analysis & Diagonstics
A common tool when forecasting and analyzing residuals, where residuals are
.resid = .actual - .prediction. The residuals may have autocorrelation or nonzero mean, which can indicate model improvement opportunities. In addition, users may which to inspect in-sample and out-of-sample residuals, which can display different results.
seasonal_reg() and set engine to “tbats”.
nnetar_reg() and set engine to “nnetar”.
Prophet Model - Logistic Growth Support
growth = 'logistic'and one or more of
logistic_floorto valid saturation boundaries.
modeltime_refit(): When modeltime model parameters update (e.g. when Auto ARIMA changes to a new model), the Model Description now alerts the user (e.g. “UPDATE: ARIMA(0,1,1)(1,1,1)”).
modeltime_calibrate(): When training data is supplied in a time window that the model has previously been trained on (e.g.
training(splits)), the calibration calculation first inspects whether the “Fitted” data exists. If it iexists, it returns the “Fitted” data. This helps prevent sequence-based (e.g. ARIMA, ETS, TBATS models) from displaying odd results because these algorithms can only predict sequences directly following the training window. If “Fitted” data is being used, the
.type column will display “Fitted” instead of “Test”.
actual_datareconciliation strategies when recipe removes rows. Strategy attempts to fill predictors using “downup” strategy to prevent
NAvalues from removing rows.
modeltime_accuracy(): Fix issue with
new_data not recalibrating.
modeltime_forecast(): Now estimates confidence intervals using centered standard deviation. The mean is assumed to be zero and residuals deviate from mean = 0.
nthreads = 1(default) to ensure parallelization is thread safe.