2022-03-17 21:03:18 +03:00
|
|
|
% Generated by roxygen2: do not edit by hand
|
2022-11-09 22:39:03 +03:00
|
|
|
% Please edit documentation in R/ensemble_models.R
|
2022-03-17 21:03:18 +03:00
|
|
|
\name{ensemble_models}
|
|
|
|
\alias{ensemble_models}
|
|
|
|
\title{Ensemble Models}
|
|
|
|
\usage{
|
|
|
|
ensemble_models(
|
2022-09-15 20:57:03 +03:00
|
|
|
run_info,
|
2022-03-17 21:03:18 +03:00
|
|
|
parallel_processing = NULL,
|
2022-11-07 01:18:56 +03:00
|
|
|
inner_parallel = FALSE,
|
2022-03-17 21:03:18 +03:00
|
|
|
num_cores = NULL,
|
|
|
|
seed = 123
|
|
|
|
)
|
|
|
|
}
|
|
|
|
\arguments{
|
2022-10-10 18:10:37 +03:00
|
|
|
\item{run_info}{run info using the \code{\link[=set_run_info]{set_run_info()}} function}
|
2022-03-20 05:23:40 +03:00
|
|
|
|
2022-10-10 18:10:37 +03:00
|
|
|
\item{parallel_processing}{Default of NULL runs no parallel processing and
|
|
|
|
forecasts each individual time series one after another. 'local_machine'
|
2022-11-07 01:18:56 +03:00
|
|
|
leverages all cores on current machine Finn is running on. 'spark'
|
|
|
|
runs time series in parallel on a spark cluster in Azure Databricks or
|
|
|
|
Azure Synapse.}
|
|
|
|
|
|
|
|
\item{inner_parallel}{Run components of forecast process inside a specific
|
|
|
|
time series in parallel. Can only be used if parallel_processing is
|
|
|
|
set to NULL or 'spark'.}
|
2022-03-20 05:23:40 +03:00
|
|
|
|
2022-10-10 18:10:37 +03:00
|
|
|
\item{num_cores}{Number of cores to run when parallel processing is set up.
|
|
|
|
Used when running parallel computations on local machine or within Azure.
|
|
|
|
Default of NULL uses total amount of cores on machine minus one. Can't
|
|
|
|
be greater than number of cores on machine minus 1.}
|
2022-03-20 05:23:40 +03:00
|
|
|
|
2022-09-24 06:30:19 +03:00
|
|
|
\item{seed}{Set seed for random number generator. Numeric value.}
|
2022-03-17 21:03:18 +03:00
|
|
|
}
|
|
|
|
\value{
|
2022-09-24 06:30:19 +03:00
|
|
|
Ensemble model outputs are written to disk
|
2022-03-17 21:03:18 +03:00
|
|
|
}
|
|
|
|
\description{
|
2022-10-10 18:10:37 +03:00
|
|
|
Create ensemble model forecasts
|
2022-03-17 21:03:18 +03:00
|
|
|
}
|
2022-09-24 06:30:19 +03:00
|
|
|
\examples{
|
|
|
|
\donttest{
|
2022-10-10 18:10:37 +03:00
|
|
|
data_tbl <- timetk::m4_monthly \%>\%
|
|
|
|
dplyr::rename(Date = date) \%>\%
|
2022-09-24 06:30:19 +03:00
|
|
|
dplyr::mutate(id = as.character(id)) \%>\%
|
2022-10-10 18:10:37 +03:00
|
|
|
dplyr::filter(
|
2023-08-10 01:02:14 +03:00
|
|
|
Date >= "2013-01-01",
|
2022-10-10 18:10:37 +03:00
|
|
|
Date <= "2015-06-01",
|
|
|
|
id == "M750"
|
|
|
|
)
|
|
|
|
|
2022-09-24 06:30:19 +03:00
|
|
|
run_info <- set_run_info()
|
|
|
|
|
2022-10-10 18:10:37 +03:00
|
|
|
prep_data(run_info,
|
|
|
|
input_data = data_tbl,
|
|
|
|
combo_variables = c("id"),
|
|
|
|
target_variable = "value",
|
|
|
|
date_type = "month",
|
|
|
|
forecast_horizon = 3
|
|
|
|
)
|
|
|
|
|
|
|
|
prep_models(run_info,
|
|
|
|
models_to_run = c("arima", "glmnet"),
|
|
|
|
num_hyperparameters = 2
|
|
|
|
)
|
|
|
|
|
|
|
|
train_models(run_info,
|
|
|
|
run_global_models = FALSE
|
|
|
|
)
|
|
|
|
|
2022-09-24 06:30:19 +03:00
|
|
|
ensemble_models(run_info)
|
|
|
|
}
|
|
|
|
}
|