Preps various aspects of run before training models. Things like train/test splits, creating hyperparameters, etc.
prep_models(
run_info,
back_test_scenarios = NULL,
back_test_spacing = NULL,
models_to_run = NULL,
models_not_to_run = NULL,
run_ensemble_models = TRUE,
pca = NULL,
num_hyperparameters = 10,
seasonal_period = NULL,
seed = 123,
custom_models = NULL
)Run info using the set_run_info() function.
Number of specific back test folds to run when determining the best model. Default of NULL will automatically choose the number of back tests to run based on historical data size, which tries to always use a minimum of 80% of the data when training a model.
Number of periods to move back for each back test scenario. Default of NULL moves back 1 period at a time for year, quarter, and month data. Moves back 4 for week and 7 for day data.
List of models to run. Default of NULL runs all models.
List of models not to run, overrides values in models_to_run. Default of NULL doesn't turn off any model.
If TRUE, prep for ensemble models.
If TRUE, run principle component analysis on any lagged features to speed up model run time. Default of NULL runs PCA on day and week date types across all local multivariate models, and also for global models across all date types.
Number of hyperparameter combinations to test out on validation data for model tuning.
One to three unique, finite numeric seasonal periods
greater than 1. Custom values are used by stlm-arima, stlm-ets, and
tbats. A value of NULL uses the defaults for date_type.
Set seed for random number generator. Numeric value.
Named list of experimental, version-bound approved
finnts_custom_model envelopes. A NULL models_to_run runs all built-in
models plus every supplied custom model; an explicit models_to_run must
name every supplied custom model, otherwise an error is raised. Supplied
custom models cannot also appear in models_not_to_run.
Raw definitions or registry references do not grant execution permission.
Writes outputs related to model prep to disk.
Experimental custom enrollment requires named finnts_custom_model
envelopes holding an exact passive definition plus technical validation and
approval bound to its content hash (version_id). Validation contains
version_id, technical_passed = TRUE, and a nonempty list of check-summary
strings. Manual approval contains the same version_id,
intent_confirmed = TRUE and allow_code = TRUE. Explicit automatic approval
has intent_confirmed = FALSE, allow_code = TRUE and mode = "automatic".
Unknown fields or modes fail. These are trusted-caller attestations, not
authenticated human identity, a sandbox or an approval inferred from storage.
Use create_custom_model() for manual or explicitly automatic authoring.
Supplied custom models run when models_to_run is NULL or names them; an
explicit models_to_run that omits one is an error. Custom models train on
the original-scale C1 recipe, which must be in the recipes_to_run given
to prep_data(); otherwise preparation errors. Built-in models selected in
the same run use R1/R2 with any supported settings (stationary, Box-Cox,
outlier cleaning, multistep, feature selection, ensembles). Built-in models
on a C1-only run error, and a prepared C1 recipe without custom models is
ignored with a warning. Custom forecasts can feed simple averages and
ensembles; negative_forecast = FALSE floors custom output at zero like
built-ins. Local/mounted storage, CSV/RDS/Parquet data and RDS model
objects are required; sequential, local-machine and Spark execution and
inner_parallel are supported. Custom recipes retain only Date, Combo and
declared predictors; no implicit PCA, feature selection or target
transformation is applied.
C1 driver availability is independent of external_regressors in
prep_data(). Required predictors must exist with complete supported
values, including supplied future values, or preparation errors.
A definition with reviewed hierarchy capability permits standard_hierarchy
or grouped_hierarchy with local univariate original-scale C1 logic. Every
prepared node receives the same explicitly selected mixed custom/FinnTS
pool. Custom-only hierarchy requests fail; no built-in is silently added.
Forecast use requires local-only custom training, no regressors, and no
weekly-to-daily expansion. Topology and exact input artifacts are pinned
before enrollment.
Definitions are pinned in the normal prepared workflows, with passive attestations attached to that same artifact; no separate standard registry or pool-manifest copy is required. Reentry requires the same approved effective pool; changed definitions or preparation context require a new run. Supplying definitions without selecting them leaves built-in defaults unchanged. Registry presence alone grants neither enrollment nor execution consent. No source is evaluated during preparation and no packages are installed.
# \donttest{
data_tbl <- timetk::m4_monthly %>%
dplyr::rename(Date = date) %>%
dplyr::mutate(id = as.character(id)) %>%
dplyr::filter(
Date >= "2012-01-01",
Date <= "2015-06-01"
)
run_info <- set_run_info()
#> Finn Submission Info
#> • Project Name: finn_project
#> • Run Name: finn_fcst-20261020T013500Z
#>
prep_data(run_info,
input_data = data_tbl,
combo_variables = c("id"),
target_variable = "value",
date_type = "month",
forecast_horizon = 3
)
#> ℹ Prepping Data
#> ✔ Prepping Data [2.6s]
#>
prep_models(run_info,
models_to_run = c("arima", "ets", "glmnet")
)
#> ℹ Creating Model Workflows
#> ✔ Creating Model Workflows [203ms]
#>
#> ℹ Creating Model Hyperparameters
#> ✔ Creating Model Hyperparameters [232ms]
#>
#> ℹ Creating Train Test Splits
#> ✔ Creating Train Test Splits [317ms]
#>
# }