Tune hyperparameters using training flags

Run all combinations of the specifed training flags. The number of combinations can be reduced by specifying the sample parameter, which will result in a random sample of the flag combinations being run.

tuning_run(file = "train.R", context = "local",
  config = Sys.getenv("R_CONFIG_ACTIVE", unset = "default"), flags = NULL,
  sample = NULL, properties = NULL,
  runs_dir = getOption("tfruns.runs_dir", "runs"), echo = TRUE,
  confirm = interactive(), envir = parent.frame(),
  encoding = getOption("encoding"))

Arguments

file

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

context

Run context (defaults to "local")

config

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.

flags

Named list with flag values (multiple values can be provided for each flag)

sample

Sampling rate for flag combinations (defaults to running all combinations).

properties

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

runs_dir

Directory containing runs. Defaults to "runs" beneath the current working directory (or to the value of the tfruns.runs_dir R option if specified).

echo

Print expressions within training script

confirm

Confirm before executing tuning run.

envir

The environment in which the script should be evaluated

encoding

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

Value

Data frame with summary of all training runs performed during tuning.

Examples

# NOT RUN {
library(tfruns)

runs <- tuning_run("mnist_mlp.R", flags = list(
  batch_size = c(64, 128),
  dropout1 = c(0.2, 0.3, 0.4),
  dropout2 = c(0.2, 0.3, 0.4)
))

runs[order(runs$eval_acc, decreasing = TRUE), ]

# }