Learn R Programming

RemixAutoML (version 0.11.0)

AutoTS: AutoTS is an automated time series modeling function

Description

Step 1 is to build all the models and evaluate them on the number of HoldOutPeriods periods you specify. Step 2 is to pick the winner and rebuild the winning model on the full data set. Step 3 is to generate forecasts with the final model for FCPeriods that you specify. AutoTS builds the best time series models for each type, using optimized box-cox transformations and using a user-supplied frequency for the ts data conversion along with a model-based frequency for the ts data conversion, compares all types, selects the winner, and generates a forecast. Models include:

Usage

AutoTS(data, TargetName = "Target", DateName = "DateTime",
  FCPeriods = 30, HoldOutPeriods = 30, EvaluationMetric = "MAPE",
  InnerEval = "AICc", TimeUnit = "day", Lags = 25, SLags = 2,
  MaxFourierPairs = 0, NumCores = 4, SkipModels = NULL,
  StepWise = TRUE, TSClean = TRUE, ModelFreq = TRUE,
  PrintUpdates = FALSE, PlotPredictionIntervals = TRUE)

Arguments

data

is the source time series data as a data.table - or a data structure that can be converted to a data.table

TargetName

is the name of the target variable in your data.table

DateName

is the name of the date column in your data.table

FCPeriods

is the number of periods into the future you wish to forecast

HoldOutPeriods

is the number of periods to use for validation testing

EvaluationMetric

Set this to either "MAPE", "MSE", or "MAE". Default is "MAPE"

InnerEval

Choose from AICC, AIC, and BIC. These are what the time series models use internally to optimize

TimeUnit

is the level of aggregation your dataset comes in. Choices include: hour, day, week, month, quarter, year, 1Min, 5Min, 10Min, 15Min, and 30Min

Lags

is the number of lags you wish to test in various models (same as moving averages)

SLags

is the number of seasonal lags you wish to test in various models (same as moving averages)

MaxFourierPairs

Set the max number of Fourier terms to test out. They will be utilized in the ARIMA and NN models.

NumCores

is the number of cores available on your computer

SkipModels

Don't run specified models - e.g. exclude all models "DSHW" "ARFIMA" "ARIMA" "ETS" "NNET" "TBATS" "TSLM"

StepWise

Set to TRUE to have ARIMA and ARFIMA run a stepwise selection process. Otherwise, all models will be generated in parallel execution, but still run much slower.

TSClean

Set to TRUE to have missing values interpolated and outliers replaced with interpolated values: creates separate models for a larger comparison set

ModelFreq

Set to TRUE to run a separate version of all models where the time series frequency is chosen algorithmically

PrintUpdates

Set to TRUE for a print to console of function progress

PlotPredictionIntervals

Set to FALSE to not print prediction intervals on your plot output

Value

Returns a list containing 1: A data.table object with a date column and the forecasted values; 2: The model evaluation results; 3: The champion model for later use if desired; 4: The name of the champion model; 5. A time series ggplot with historical values and forecasted values with 80

Details

DSHW: Double Seasonal Holt Winters

ARFIMA: Auto Regressive Fractional Integrated Moving Average

ARIMIA: Stepwise Auto Regressive Integrated Moving Average with specified max lags, seasonal lags, moving averages, and seasonal moving averages

ETS: Additive and Multiplicitive Exponential Smoothing and Holt Winters

NNetar: Auto Regressive Neural Network models automatically compares models with 1 lag or 1 seasonal lag compared to models with up to N lags and N seasonal lags

TBATS: Exponential smoothing state space model with Box-Cox transformation, ARMA errors, Trend and Seasonal components

TSLM: Time Series Linear Model - builds a linear model with trend and season components extracted from the data

See Also

Other Automated Time Series: AutoCatBoostCARMA, AutoH2oDRFCARMA, AutoH2oGBMCARMA, AutoXGBoostCARMA

Examples

Run this code
# NOT RUN {
data <- data.table::data.table(DateTime = as.Date(Sys.time()),
  Target = stats::filter(rnorm(100,
                               mean = 50,
                               sd = 20),
                         filter=rep(1,10),
                         circular=TRUE))
data[, temp := seq(1:100)][, DateTime := DateTime - temp][, temp := NULL]
data <- data[order(DateTime)]
output <-   AutoTS(data,
                   TargetName              = "Target",
                   DateName                = "DateTime",
                   FCPeriods               = 1,
                   HoldOutPeriods          = 1,
                   EvaluationMetric        = "MAPE",
                   InnerEval               = "AICc",
                   TimeUnit                = "day",
                   Lags                    = 1,
                   SLags                   = 1,
                   MaxFourierPairs         = 0,
                   NumCores                = 4,
                   SkipModels              = c("NNET","TBATS","ETS","TSLM","ARFIMA","DSHW"),
                   StepWise                = TRUE,
                   TSClean                 = FALSE,
                   ModelFreq               = TRUE,
                   PlotPredictionIntervals = TRUE,
                   PrintUpdates            = FALSE)
ForecastData <- output$Forecast
ModelEval    <- output$EvaluationMetrics
WinningModel <- output$TimeSeriesModel
# }

Run the code above in your browser using DataLab