Run a training script

Run a training script

training_run(file = "train.R", context = "local",
  config = Sys.getenv("R_CONFIG_ACTIVE", unset = "default"), flags = NULL,
  properties = NULL, run_dir = NULL, echo = TRUE, view = "auto",
  envir = parent.frame(), encoding = getOption("encoding"))



Path to training script (defaults to "train.R")


Run context (defaults to "local")


The configuration to use. Defaults to the active configuration for the current environment (as specified by the R_CONFIG_ACTIVE environment variable), or default when unset.


Named list with flag values (see flags()) or path to YAML file containing flag values.


Named character vector with run properties. Properties are additional metadata about the run which will be subsequently available via ls_runs().


Directory to store run data within


Print expressions within training script


View the results of the run after training. The default "auto" will view the run when executing a top-level (printed) statement in an interactive session. Pass TRUE or FALSE to control whether the view is shown explictly. You can also pass "save" to save a copy of the run report at tfruns.d/view.html


The environment in which the script should be evaluated


The encoding of the training script; see file().


Single row data frame with run flags, metrics, etc.


The training run will by default use a unique new run directory within the "runs" sub-directory of the current working directory (or to the value of the tfruns.runs_dir R option if specified).

The directory name will be a timestamp (in GMT time). If a duplicate name is generated then the function will wait long enough to return a unique one.

If you want to use an alternate directory to store run data you can either set the global tfruns.runs_dir R option, or you can pass a run_dir explicitly to training_run(), optionally using the unique_run_dir() function to generate a timestamp-based directory name.