
Last chance! 50% off unlimited learning
Sale ends in
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:
AutoTS(data, TargetName = "Target", DateName = "DateTime",
FCPeriods = 30, HoldOutPeriods = 30, EvaluationMetric = "MAPE",
TimeUnit = "day", Lags = 25, SLags = 2, NumCores = 4,
SkipModels = NULL, StepWise = TRUE, TSClean = TRUE,
ModelFreq = TRUE, PrintUpdates = FALSE)
is the source time series data as a data.table - or a data structure that can be converted to a data.table
is the name of the target variable in your data.table
is the name of the date column in your data.table
is the number of periods into the future you wish to forecast
is the number of periods to use for validation testing
Set this to either "MAPE", "MSE", or "MAE". Default is "MAPE"
is the level of aggregation your dataset comes in
is the number of lags you wish to test in various models (same as moving averages)
is the number of seasonal lags you wish to test in various models (same as moving averages)
is the number of cores available on your computer
Don't run specified models - e.g. exclude all models "DSHW" "ARFIMA" "ARIMA" "ETS" "NNET" "TBATS" "TSLM"
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.
Set to TRUE to have missing values interpolated and outliers replaced with interpolated values: creates separate models for a larger comparison set
Set to TRUE to run a separate version of all models where the time series frequency is chosen algorithmically
Set to TRUE for a print to console of function progress
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.
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
Other Time Series: AutoCatBoostCARMA
,
AutoH2oDRFCARMA
,
AutoH2oGBMCARMA
,
AutoXGBoostCARMA
# 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",
TimeUnit = "day",
Lags = 1,
SLags = 1,
NumCores = 4,
SkipModels = c("NNET","TBATS","ETS","TSLM","ARFIMA","DSHW"),
StepWise = TRUE,
TSClean = FALSE,
ModelFreq = TRUE,
PrintUpdates = FALSE)
ForecastData <- output$Forecast
ModelEval <- output$EvaluationMetrics
WinningModel <- output$TimeSeriesModel
# }
Run the code above in your browser using DataLab